initialize method
使用模型路径初始化 OCR 引擎。
Implementation
@override
Future<bool> initialize({
required String detModelPath,
required String recModelPath,
required String dictPath,
}) async {
_log('initialize: detModelPath="$detModelPath"');
_log('initialize: recModelPath="$recModelPath"');
_log('initialize: dictPath="$dictPath"');
try {
final result = await _channel.invokeMethod<bool>('initialize', {
'detModelPath': detModelPath,
'recModelPath': recModelPath,
'dictPath': dictPath,
});
_log('initialize: native returned result=$result');
return result ?? false;
} on PlatformException catch (e) {
_log('initialize: PlatformException code=${e.code} message=${e.message} '
'details=${e.details}');
rethrow;
} catch (e, st) {
_log('initialize: unexpected error', error: e, stackTrace: st);
rethrow;
}
}