checkModelUpdates method
Future<ModelUpdateInfo>
checkModelUpdates({
- required OCRModule module,
- String? apiKey,
- String? token,
- PlatformType platformType = PlatformType.flutter,
Checks if a newer model version is available on the server.
Returns ModelUpdateInfo with update availability details. Throws ModelNetworkException on network failure.
Implementation
Future<ModelUpdateInfo> checkModelUpdates({
required OCRModule module,
String? apiKey,
String? token,
PlatformType platformType = PlatformType.flutter,
}) async {
try {
final result = await _channel.invokeMethod<Map<dynamic, dynamic>>('checkModelUpdates', {
'modelClass': _modelClassToInt(module.modelClass),
'modelSize': _modelSizeToInt(module.modelSize),
'apiKey': apiKey,
'token': token,
'platformType': platformType.value,
});
if (result == null) {
throw ModelNetworkException(module: module, message: 'Failed to check updates');
}
return ModelUpdateInfo.fromMap(result);
} on PlatformException catch (e) {
throw _mapPlatformException(e, module);
}
}