Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Device Id in flutter of both Android and IOS

Is there a way to get the device id for android and ios, because when I do it for android using the device_info plugin, it says this:

MissingPluginException(No implementation found for method getAndroidDeviceInfo on channel plugins.flutter.io/device_info)

like image 981
Coder Avatar asked Jan 28 '23 13:01

Coder


1 Answers

Turns out you don't actually need a package all the functionality to get Device info is inside a flutter class called flutter.io.

You can simply tap into it with this line of code as an import :

import 'dart:io' show Platform;

then to execute platform specific code you can use :

     if (Platform.iOS)
 {//your code} 
else if (Platform.Android)
{//your other code}
like image 71
Dyary Avatar answered Jan 31 '23 19:01

Dyary