warmUp method

  1. @override
Future<String> warmUp()
override

Builds the classifier and returns the bundled model version.

Throws CardGateException when the model, policy or labels cannot be loaded, or when the model does not match the SHA-256 in the policy.

Implementation

@override
Future<String> warmUp() async {
  try {
    final modelVersion = await methodChannel.invokeMethod<String>('warmUp');
    if (modelVersion == null || modelVersion.isEmpty) {
      throw const CardGateException(
        CardGateException.codeUnavailable,
        'Native warmUp returned no model version',
      );
    }
    return modelVersion;
  } on PlatformException catch (error) {
    throw _fromPlatform(error, 'Card Gate warm-up failed');
  } on MissingPluginException catch (error) {
    throw _missingPlugin(error);
  }
}