PlatformSummary.fromMap constructor

PlatformSummary.fromMap(
  1. Map<Object?, Object?> map
)

Creates a PlatformSummary from a map returned by the native platform.

Implementation

factory PlatformSummary.fromMap(Map<Object?, Object?> map) {
  final int androidSdk = _readInt(map, 'androidSdk');
  final String androidRelease = _readString(map, 'androidRelease');

  return PlatformSummary(
    manufacturer: _readString(map, 'manufacturer'),
    brand: _readString(map, 'brand'),
    model: _readString(map, 'model'),
    device: _readString(map, 'device'),
    product: _readString(map, 'product'),
    androidSdk: androidSdk,
    androidRelease: androidRelease,
    platformName:
        _readOptionalString(map, 'platformName') ??
        (androidSdk > 0 ? 'android' : null),
    osName:
        _readOptionalString(map, 'osName') ??
        (androidSdk > 0 ? 'Android' : null),
    osVersion: _readOptionalString(map, 'osVersion') ?? androidRelease,
    localizedModel: _readOptionalString(map, 'localizedModel'),
    appEnvironment: _readOptionalString(map, 'appEnvironment'),
    isPhysicalDevice: _readOptionalBool(map, 'isPhysicalDevice'),
    isSimulator: _readOptionalBool(map, 'isSimulator'),
    physicalMemoryBytes: _readOptionalInt(map, 'physicalMemoryBytes'),
    processorCount: _readOptionalInt(map, 'processorCount'),
    activeProcessorCount: _readOptionalInt(map, 'activeProcessorCount'),
    thermalState: _readOptionalString(map, 'thermalState'),
    isIosNative: _readBool(map, 'isIosNative'),
  );
}