performDirectApiScan method

  1. @override
Future<BlinkCardScanningResult?> performDirectApiScan({
  1. required BlinkCardSdkSettings blinkCardSdkSettings,
  2. required BlinkCardSessionSettings blinkCardSessionSettings,
  3. required String firstSideImage,
  4. String? secondSideImage,
})
override

The performDirectApiScan platform channel method launches the BlinkCard scanning process intended for information extraction from static images. It takes the following parameters: BlinkCardSdkSettings, BlinkCardSessionSettings, firstImage String in the Base64 format and the optional secondImage String in the Base64 format.

  1. BlinkCard SDK Settings - BlinkCardSdkSettings: the class that contains all of the available SDK settings. It contains settings for the license key, and how the models (that the SDK needs for the scanning process) should be obtained. To obtain a valid license key, please visit https://developer.microblink.com/ or contact us directly at https://help.microblink.com

  2. BlinkCard Session Settings - BlinkCardSessionSettings: the class that contains specific scanning configurations that define how the scanning session should behave. If not used, the default SessionSettings will be applied.

  3. The firstImage Base64 string - String: image that represents one side of the card. Should be the image where the card number is located.

  4. The optional secondImage Base64 string - String: needed if the information from other side of the document is required and not all information from the first side of the

Implementation

@override
Future<BlinkCardScanningResult?> performDirectApiScan({
  required BlinkCardSdkSettings blinkCardSdkSettings,
  required BlinkCardSessionSettings blinkCardSessionSettings,
  required String firstSideImage,
  String? secondSideImage,
}) async {
  final jsonBlinkCardResult = await methodChannel
      .invokeMethod(ARG_PERFORM_DIRECT_API_SCAN, {
        ARG_BLINKCARD_SDK_SETTINGS: jsonDecode(
          jsonEncode(blinkCardSdkSettings),
        ),
        ARG_BLINKCARD_SESSION_SETTINGS: jsonDecode(
          jsonEncode(blinkCardSessionSettings),
        ),
        ARG_FIRST_SIDE_IMAGE: firstSideImage,
        ARG_SECOND_SIDE_IMAGE: secondSideImage,
      });

  final decodedNativeBlinkCardResult = Map<String, dynamic>.from(
    jsonDecode(jsonBlinkCardResult),
  );
  return BlinkCardScanningResult(decodedNativeBlinkCardResult);
}