1

I need to get Device_id for my flutter web application, I mean when I open the application on the browser on mobile I need to get the device id.

I have tried all sorts of libs but all they give is browser data. How can I solve this?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65

1 Answers1

0

use package device_info

you can use flutter package  <device_info>  to get device info.
following function will help to get device id

Future<String> _getId() async {
 var deviceInfo = DeviceInfoPlugin();
 if (Platform.isIOS) {
   // import 'dart:io'
   var iosDeviceInfo = await deviceInfo.iosInfo;
   return iosDeviceInfo.identifierForVendor; // unique ID on iOS
 } else {
   var androidDeviceInfo = await deviceInfo.androidInfo;
   return androidDeviceInfo.androidId; // unique ID on Android
 }
}
Huzaifa
  • 39
  • 4
  • 2
    I want to use the web, not android or ios , I want to get the device id when I'm opening the app through browser on mobile devices – saeed bayat Jan 19 '22 at 08:34