start_generalDelegate method
Implementation
Future<bool?> start_generalDelegate(String key, BMKGeneralDelegate delegate) async {
// print log
if (fluttifyLogEnabled) {
debugPrint('fluttify-dart: BMKMapManager@$refId::start([\'key\':$key])');
}
// invoke native method
final __result__ = await kBmapCoreFluttifyChannel.invokeMethod('BMKMapManager::start_generalDelegate', {"key": key, "delegate": delegate, "__this__": this});
// handle native call
MethodChannel('BMKGeneralDelegate::Callback', kBmapCoreFluttifyMethodCodec)
.setMethodCallHandler((methodCall) async {
try {
final args = methodCall.arguments as Map;
switch (methodCall.method) {
case 'Callback::BMKGeneralDelegate::onGetNetworkState':
// print log
if (fluttifyLogEnabled) {
debugPrint('fluttify-dart-callback: onGetNetworkState([\'iError\':${args['iError']}])');
}
// handle the native call
await delegate.onGetNetworkState(args['iError']);
break;
case 'Callback::BMKGeneralDelegate::onGetPermissionState':
// print log
if (fluttifyLogEnabled) {
debugPrint('fluttify-dart-callback: onGetPermissionState([\'iError\':${args['iError']}])');
}
// handle the native call
await delegate.onGetPermissionState(args['iError']);
break;
default:
throw MissingPluginException('方法${methodCall.method}未实现');
break;
}
} catch (e) {
debugPrint(e.toString());
rethrow;
}
});
return __result__;
}