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?
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?
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
}
}