fromMap static method

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

Implementation

static ScannerPreview fromMap(Map<Object?, Object?> map) {
  double number(Object? value, [double fallback = 0]) =>
      value is num ? value.toDouble() : fallback;
  return ScannerPreview(
    textureId: (map['textureId']! as num).toInt(),
    previewSize: Size(number(map['previewWidth']), number(map['previewHeight'])),
    analysisSize: Size(
      number(map['analysisWidth']),
      number(map['analysisHeight']),
    ),
    rotationDegrees: (map['rotationDegrees'] as num?)?.toInt() ?? 0,
    facing: map['facing'] == 'front' ? CameraFacing.front : CameraFacing.back,
    isMirrored: map['isMirrored'] == true,
    hasTorch: map['hasTorch'] == true,
    minZoom: number(map['minZoom'], 1),
    maxZoom: number(map['maxZoom'], 1),
  );
}