NativeLensTaskRequirements.fromMap constructor

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

Creates requirements from a map using stable field names.

Implementation

factory NativeLensTaskRequirements.fromMap(Map<Object?, Object?> map) {
  return NativeLensTaskRequirements(
    requiresCamera: _readBool(map, 'requiresCamera', defaultValue: false),
    requiresMicrophone: _readBool(
      map,
      'requiresMicrophone',
      defaultValue: false,
    ),
    requiresStableNetwork: _readBool(
      map,
      'requiresStableNetwork',
      defaultValue: false,
    ),
    requiresUnmeteredNetwork: _readBool(
      map,
      'requiresUnmeteredNetwork',
      defaultValue: false,
    ),
    requiresHevcEncoder: _readBool(
      map,
      'requiresHevcEncoder',
      defaultValue: false,
    ),
    requiresMediaCodecs: _readBool(
      map,
      'requiresMediaCodecs',
      defaultValue: false,
    ),
    requiredSensors: _readStringList(map, 'requiredSensors'),
    requiredSystemFeatures: _readStringList(map, 'requiredSystemFeatures'),
    minBatteryLevel: _readOptionalInt(map, 'minBatteryLevel'),
    minRefreshRate: _readOptionalDouble(map, 'minRefreshRate'),
    minCameraCount: _readOptionalInt(map, 'minCameraCount'),
    minSensorCount: _readOptionalInt(map, 'minSensorCount'),
    minCodecCount: _readOptionalInt(map, 'minCodecCount'),
    allowPowerSaveMode: _readBool(
      map,
      'allowPowerSaveMode',
      defaultValue: true,
    ),
  );
}