toMap method

  1. @override
Map<String, dynamic> toMap()

Implementation

@override
Map<String, dynamic> toMap() {
  var json = <String, dynamic>{
    'View': {
      'style': _style.toString(),
      'shouldShowUserGuidanceView': shouldShowUserGuidanceView,
      'shouldShowListButton': shouldShowListButton,
      'shouldShowExitButton': shouldShowExitButton,
      'shouldShowShutterButton': shouldShowShutterButton,
      'shouldShowHints': shouldShowHints,
      'shouldShowClearHighlightsButton': shouldShowClearHighlightsButton,
      'shouldShowSingleScanButton': shouldShowSingleScanButton,
      'shouldShowFloatingShutterButton': shouldShowFloatingShutterButton,
      'shouldShowToolbar': shouldShowToolbar,
      'shouldShowScanAreaGuides': shouldShowScanAreaGuides,
      'toolbarSettings': _toolbarSettings?.toMap(),
      'shouldShowListProgressBar': shouldShowListProgressBar,
      'shouldShowTorchControl': shouldShowTorchControl,
      'torchControlPosition': torchControlPosition.toString()
    },
    'BarcodeCount': _barcodeCount.toMap()
  };

  if (listButtonAccessibilityHint != BarcodeCountDefaults.viewDefaults.listButtonAccessibilityHint) {
    json['View']['listButtonAccessibilityHint'] = listButtonAccessibilityHint; // iOS Only
  }

  if (listButtonAccessibilityLabel != BarcodeCountDefaults.viewDefaults.listButtonAccessibilityLabel) {
    json['View']['listButtonAccessibilityLabel'] = listButtonAccessibilityLabel; // iOS Only
  }

  if (listButtonContentDescription != BarcodeCountDefaults.viewDefaults.listButtonContentDescription) {
    json['View']['listButtonContentDescription'] = listButtonContentDescription; // Android only
  }

  if (exitButtonAccessibilityHint != BarcodeCountDefaults.viewDefaults.exitButtonAccessibilityHint) {
    json['View']['exitButtonAccessibilityHint'] = exitButtonAccessibilityHint; // iOS Only
  }

  if (exitButtonAccessibilityLabel != BarcodeCountDefaults.viewDefaults.exitButtonAccessibilityLabel) {
    json['View']['exitButtonAccessibilityLabel'] = exitButtonAccessibilityLabel; // iOS Only
  }

  if (exitButtonContentDescription != BarcodeCountDefaults.viewDefaults.exitButtonContentDescription) {
    json['View']['exitButtonContentDescription'] = exitButtonContentDescription; // Android only
  }

  if (shutterButtonAccessibilityHint != BarcodeCountDefaults.viewDefaults.shutterButtonAccessibilityHint) {
    json['View']['shutterButtonAccessibilityHint'] = shutterButtonAccessibilityHint; // iOS Only
  }

  if (shutterButtonAccessibilityLabel != BarcodeCountDefaults.viewDefaults.shutterButtonAccessibilityLabel) {
    json['View']['shutterButtonAccessibilityLabel'] = shutterButtonAccessibilityLabel; // iOS Only
  }

  if (shutterButtonContentDescription != BarcodeCountDefaults.viewDefaults.shutterButtonContentDescription) {
    json['View']['shutterButtonContentDescription'] = shutterButtonContentDescription; // Android Only
  }

  if (floatingShutterButtonAccessibilityHint !=
      BarcodeCountDefaults.viewDefaults.floatingShutterButtonAccessibilityHint) {
    json['View']['floatingShutterButtonAccessibilityHint'] = floatingShutterButtonAccessibilityHint; // iOS Only
  }

  if (floatingShutterButtonAccessibilityLabel !=
      BarcodeCountDefaults.viewDefaults.floatingShutterButtonAccessibilityLabel) {
    json['View']['floatingShutterButtonAccessibilityLabel'] = floatingShutterButtonAccessibilityLabel; // iOS Only
  }

  if (floatingShutterButtonContentDescription !=
      BarcodeCountDefaults.viewDefaults.floatingShutterButtonContentDescription) {
    json['View']['floatingShutterButtonContentDescription'] = floatingShutterButtonContentDescription; // Android only
  }

  if (clearHighlightsButtonAccessibilityHint !=
      BarcodeCountDefaults.viewDefaults.clearHighlightsButtonAccessibilityHint) {
    json['View']['clearHighlightsButtonAccessibilityHint'] = clearHighlightsButtonAccessibilityHint; // iOS only
  }

  if (clearHighlightsButtonAccessibilityLabel !=
      BarcodeCountDefaults.viewDefaults.clearHighlightsButtonAccessibilityLabel) {
    json['View']['clearHighlightsButtonAccessibilityLabel'] = clearHighlightsButtonAccessibilityLabel; // iOS only
  }

  if (clearHighlightsButtonContentDescription !=
      BarcodeCountDefaults.viewDefaults.clearHighlightsButtonContentDescription) {
    json['View']['clearHighlightsButtonContentDescription'] = clearHighlightsButtonContentDescription; // Android Only
  }

  if (singleScanButtonAccessibilityHint != BarcodeCountDefaults.viewDefaults.singleScanButtonAccessibilityHint) {
    json['View']['singleScanButtonAccessibilityHint'] = singleScanButtonAccessibilityHint; // iOS Only
  }

  if (singleScanButtonAccessibilityLabel != BarcodeCountDefaults.viewDefaults.singleScanButtonAccessibilityLabel) {
    json['View']['singleScanButtonAccessibilityLabel'] = singleScanButtonAccessibilityLabel; // iOS Only
  }

  if (singleScanButtonContentDescription != BarcodeCountDefaults.viewDefaults.singleScanButtonContentDescription) {
    json['View']['singleScanButtonContentDescription'] = singleScanButtonContentDescription; // Android Only
  }

  if (clearHighlightsButtonText != BarcodeCountDefaults.viewDefaults.clearHighlightsButtonText) {
    json['View']['clearHighlightsButtonText'] = clearHighlightsButtonText;
  }

  if (exitButtonText != BarcodeCountDefaults.viewDefaults.exitButtonText) {
    json['View']['exitButtonText'] = exitButtonText;
  }

  if (textForTapShutterToScanHint != BarcodeCountDefaults.viewDefaults.textForTapShutterToScanHint) {
    json['View']['textForTapShutterToScanHint'] = textForTapShutterToScanHint;
  }

  if (textForScanningHint != BarcodeCountDefaults.viewDefaults.textForScanningHint) {
    json['View']['textForScanningHint'] = textForScanningHint;
  }

  if (textForMoveCloserAndRescanHint != BarcodeCountDefaults.viewDefaults.textForMoveCloserAndRescanHint) {
    json['View']['textForMoveCloserAndRescanHint'] = textForMoveCloserAndRescanHint;
  }

  if (textForMoveFurtherAndRescanHint != BarcodeCountDefaults.viewDefaults.textForMoveFurtherAndRescanHint) {
    json['View']['textForMoveFurtherAndRescanHint'] = textForMoveFurtherAndRescanHint;
  }

  if (textForUnrecognizedBarcodesDetectedHint !=
      BarcodeCountDefaults.viewDefaults.textForUnrecognizedBarcodesDetectedHint) {
    json['View']['textForUnrecognizedBarcodesDetectedHint'] = textForUnrecognizedBarcodesDetectedHint;
  }

  if (recognizedBrush != null) {
    json['View']['recognizedBrush'] = recognizedBrush?.toMap();
  }
  if (unrecognizedBrush != null) {
    json['View']['unrecognizedBrush'] = unrecognizedBrush?.toMap();
  }
  if (notInListBrush != null) {
    json['View']['notInListBrush'] = notInListBrush?.toMap();
  }
  if (filterSettings != null) {
    json['View']['filterSettings'] = filterSettings?.toMap();
  }

  return json;
}