getDeviceInfo method

  1. @override
Future<DeviceInfo> getDeviceInfo()
override

Implementation

@override
Future<DeviceInfo> getDeviceInfo() async {
  try {
    final Map<dynamic, dynamic>? res = await methodChannel.invokeMethod('getDeviceInfo');
    if (res == null) return const DeviceInfo();
    return DeviceInfo.fromMap(res.cast<String, dynamic>());
  } on PlatformException catch (e) {
    throw DeviceInspectorException(_mapErrorCode(e.code), e.message ?? 'Failed to get device info', cause: e);
  } catch (e) {
    return const DeviceInfo();
  }
}