build method

Implementation

Future<BarcodePickViewHighlightStyleResponse> build() async {
  String? iconBase64;
  String? selectedIconBase64;
  ScanditIcon? iconScandit;
  ScanditIcon? selectedIconScandit;

  switch (_iconType) {
    case _IconType.image:
      iconBase64 = await _iconImage?.base64String;
      break;
    case _IconType.asset:
      if (_iconAsset != null) {
        final ByteData data = await rootBundle.load(_iconAsset!);
        final Uint8List bytes = data.buffer.asUint8List();
        iconBase64 = base64Encode(bytes);
      }
      break;
    case _IconType.scandit:
      iconScandit = _iconScandit;
      break;
    case _IconType.none:
      break;
  }

  switch (_selectedIconType) {
    case _IconType.image:
      selectedIconBase64 = await _selectedIconImage?.base64String;
      break;
    case _IconType.asset:
      if (_selectedIconAsset != null) {
        final ByteData data = await rootBundle.load(_selectedIconAsset!);
        final Uint8List bytes = data.buffer.asUint8List();
        selectedIconBase64 = base64Encode(bytes);
      }
      break;
    case _IconType.scandit:
      selectedIconScandit = _selectedIconScandit;
      break;
    case _IconType.none:
      break;
  }

  return BarcodePickViewHighlightStyleResponse._(
    brush: _brush,
    selectedBrush: _selectedBrush,
    iconBase64: iconBase64,
    iconScandit: iconScandit,
    selectedIconBase64: selectedIconBase64,
    selectedIconScandit: selectedIconScandit,
    statusIconStyle: _statusIconStyle,
  );
}