community
community copied to clipboard
How to get MAC address for windows
- Add Dependency: Add the network_info_plus package to your pubspec.yaml
dependencies: flutter: sdk: flutter network_info_plus: ^5.0.0 # Check for the latest version
- Import the Package: Import the package in your Dart file
import 'package:network_info_plus/network_info_plus.dart';
- Get MAC Address: Use the NetworkInfo class to fetch the MAC address. Here's an example:
void getMacAddress() async { final NetworkInfo networkInfo = NetworkInfo(); String? wifiBSSID = await networkInfo.getWifiBSSID(); // This gives the MAC address print('MAC Address: $wifiBSSID'); }
It will be print Mac Address!