getDeviceInfo static method

Future<DeviceDetailsPlugin?> getDeviceInfo()

Implementation

static Future<DeviceDetailsPlugin?> getDeviceInfo() async {
  try {
    final Map<dynamic, dynamic> map = Platform.isIOS
        ? await _channel.invokeMethod("getiOSInfo")
        : await _channel.invokeMethod("getAndroidInfo");
    _deviceDetailsPlugin = DeviceDetailsPlugin(
        appName: map["appName"],
        packageName: map["packageName"],
        version: map["version"],
        buildNumber: map["buildNumber"],
        flutterAppVersion: map["flutterAppVersion"],
        osVersion: map['osVersion'],
        totalInternalStorage: map['totalInternalStorage'],
        freeInternalStorage: map['freeInternalStorage'],
        networkOperator: map['mobileNetwork'],
        totalRAMSize: map['totalRamSize'],
        freeRAMSize: map['freeRamSize'],
        screenSizeInInches: map['screenSize'],
        manufacturer: map['manufacturer'],
        deviceId: map['deviceId'],
        currentDateTime: map['dateAndTime']);
    print(_deviceDetailsPlugin?.deviceId);
  } on PlatformException catch (e) {
    print(
        'DeviceDetailsPlugin error: ${true}, code: ${e.code}, message: ${e.message}');
  }
  return _deviceDetailsPlugin;
}