How to Get MAC Address of Device in Flutter? Last Updated : 20 Feb, 2022 Comments Improve Suggest changes Like Article Like Report Flutter SDK is an open-source software development kit by Google to develop applications for multiple platforms from a single codebase. Sometimes, your app needs to know the MAC address of the device. MAC (Media Access Control) address is the unique identifier of a device on a LAN network. Approach: Use the flutter package get_mac to get the MAC address of the client's device. Step by Step Implementation Step 1: Navigate to pubspec.yaml file Open your project in VS Code and navigate to pubspec.yaml file: Step 2: Add the dependency Add the get_mac dart package as the dependency and save the file. Step 3: Download the dependencies Open the terminal in VS code and run the below command to download the added dependencies. flutter pub get Step 4: Example Code We will use the macAddress property of GetMac to get the MAC address of the device. This works with both iOS and Android devices. Syntax: String macAddress = await GetMac.macAddress; Dart import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:get_mac/get_mac.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( title: 'MAC Finder', theme: ThemeData( primarySwatch: Colors.green, ), home: const Home(), ); } } class Home extends StatefulWidget { const Home({Key? key}) : super(key: key); @override State<Home> createState() => _HomeState(); } class _HomeState extends State<Home> { String _deviceMAC = 'Click the button.'; // Platform messages are async in nature // that's why we made a async function. Future<void> initMacAddress() async { String macAddress; try { macAddress = await GetMac.macAddress; } on PlatformException { macAddress = 'Error getting the MAC address.'; } setState(() { _deviceMAC = macAddress; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('MAC address of a device'), ), body: Center( child: Column( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( _deviceMAC, style: const TextStyle(fontSize: 26, fontWeight: FontWeight.bold), ), ElevatedButton( onPressed: () { initMacAddress(); }, child: const Text("Get MAC Address"), ), ], ), ), ); } } Output: Note: The get_mc package does not support null safety. You may have to use: flutter run --no-sound-null-safety to run the app. Comment More infoAdvertise with us Next Article How to Get MAC Address of Device in Flutter? vpsop Follow Improve Article Tags : How To Dart Flutter Geeks Premier League Geeks-Premier-League-2022 Similar Reads How to Get Address From Coordinates in Flutter? Google Maps is of the most used application nowadays for navigation. Sometimes we don't know the actual address so we search the location from coordinates such as Longitude and Latitude. In this article, we are going to see how to get the actual Address of the Actual location by passing the coordina 4 min read How to Add Custom Markers on Google Maps in Flutter? Google Maps is one of the popular apps used nowadays for navigation or locating markers on Google Maps. We have seen markers on Google Maps for various locations. But In this article, we are going to see how to implement multiple custom markers on Google Maps in Flutter. Step By Step ImplementationS 4 min read How to get the MAC Address â 10 Different Methods â Kali Linux MAC Address or Media Access Control Address is the unique address that is issued to our system by the network interface controller (NIC) for seamless communication at the DDL (Data Link Layer) of the Network Segment. This MAC address is also used as a network address for different network topologies 5 min read How to Draw Polygon on Google Maps in Flutter? Google Maps is used in many Android applications. We can use Polygons to represent routes or areas in Google Maps. So in this article, we are going to see how to Draw Polygon in Google Maps in Flutter. Step By Step ImplementationStep 1: Create a New Project in Android StudioTo set up Flutter Develop 4 min read How to Add Local Notifications in Flutter? A push notification is a short message that appears as a pop-up on your desktop browser, mobile home screen, or in your device notification center from a mobile app. For receiving and showcasing push notifications in flutter using local_notifications. There are 3 conditions when we receive notificat 6 min read How to Add Firebase to Flutter App? Firebase is a product of Google that helps developers to build, manage, and grow their apps easily. It helps developers to build their apps faster and more securely. No programming is required on the Firebase side which makes it easy to use its features more efficiently. It provides services to Andr 3 min read How to Install Flutter App on Android? The hottest and trending cross-platform framework, Flutter is Google's SDK for crafting beautiful, fast user experiences for mobile, web, and desktop with just a single codebase, meaning you write for one, build for three. Flutter works with existing code, is used by developers and organizations aro 4 min read How to Build a Flutter App to Display Device Details? Here we are going to build an android application using flutter that displays device information on which it is running. To display information about the device we are going to use a package called device_info_plus. Create Flutter Project: Now remove all the existing code and remove the test folder 5 min read How to Generate SHA-1 Key in Flutter? SHA-1(Secure Hash Algorithm) is the unique identity of your Application. In Flutter, you can use these keys for various purposes such as adding Firebase to your app, Google Maps API integration, and more. For example, to add Firebase to your app, you need to provide the SHA-1 and SHA-256 keys to the 2 min read How to Add Firebase into Flutter in a New Way? Recently Firebase give another option for adding Firebase to Flutter and It is only made for Flutter, As of now we add firebase using the android option for flutter but now we can add using the flutter option that is recently updated by Flutter. Here you can find how to add firebase as an Android in 2 min read Like