getDeviceInfo static method

Future<Map<String, String>> getDeviceInfo()

Implementation

static Future<Map<String, String>> getDeviceInfo() async {
  final String token = await _getFirebaseToken();
  String imei;
  String type, name, os, version;
  version = (await PackageInfo.fromPlatform()).version;
  if (Platform.isAndroid) {
    type = 'Android';
    var androidInfo = await PlatformDeviceId.deviceInfoPlugin.androidInfo;
    os = androidInfo.version.release;
    name = androidInfo.model;
    imei = await _getDeviceId();
  } else {
    type = 'iOS';
    var iosInfo = await PlatformDeviceId.deviceInfoPlugin.iosInfo;
    os = iosInfo.systemVersion;
    name = iosInfo.name;
    imei = iosInfo.identifierForVendor;
  }
  return {
    'imei': imei,
    'name': name,
    'type': type,
    'os': os,
    'version': version,
    'token': token
  };
}