fromMap static method
Implementation
static UCodeScanOptions fromMap(Map<Object?, Object?> map) {
final Object? rawFormats = map["formats"];
final Object? rawRegion = map["region"];
return UCodeScanOptions(
formats: rawFormats is List<Object?>
? rawFormats
.map((Object? name) => UCodeFormat.values.firstWhere((UCodeFormat f) => f.name == name, orElse: () => UCodeFormat.unknown))
.where((UCodeFormat f) => f != UCodeFormat.unknown)
.toList(growable: false)
: const <UCodeFormat>[],
multiple: map["multiple"] == true,
tryHarder: map["tryHarder"] != false,
tryRotate: map["tryRotate"] != false,
tryInvert: map["tryInvert"] == true,
tryDownscale: map["tryDownscale"] != false,
maxSymbols: (map["maxSymbols"] as num?)?.toInt() ?? 8,
region: rawRegion is List<Object?> && rawRegion.length == 4
? Rect.fromLTWH(
((rawRegion[0] as num?) ?? 0).toDouble(),
((rawRegion[1] as num?) ?? 0).toDouble(),
((rawRegion[2] as num?) ?? 0).toDouble(),
((rawRegion[3] as num?) ?? 0).toDouble(),
)
: null,
);
}