BestBurning / platform_device_id

flutter plugin to get device id

Home Page:https://pub.dev/packages?q=platform_device_id

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Desktop implementations would be simplified

abner opened this issue · comments

First of all, this is an amazing package. Thank you.

Just want to suggest something here: The desktop implementations would be simplified, just by calling the respective command line processes through dart:io Platform.run, like:

For linux, it would be:

var process = await Process.run(
    'dmidecode',
    ['-s', 'system-uuid'],
    mode: ProcessStartMode.normal,
    runInShell: true
  )
  .whenComplete(() => print('Completed')).catchError((error, stackTrace) {
    print('ERROR: $error');
  });
String systemUuid = '';
if (process.exitCode == 0) {
  systemUuid = utf8.decode(process.stdout);
}

I think it should work on windows, calling wmic csproduct get UUID and on MacOSX calling ioreg -l | grep IOPlatformUUID | awk 'NR==1{print $4}' | sed 's/\"//g'.

Maybe pipe operations would not work in Process.run call (i did not test it), but it can easily be handled on the Dart-side