Sets a callback for receiving method calls on this channel.
The given callback will replace the currently registered callback for this channel, if any. To remove the handler, pass null as the handler
argument.
If the future returned by the handler completes with a result, that value is sent back to the platform plugin caller wrapped in a success envelope as defined by the codec of this channel. If the future completes with a PlatformException, the fields of that exception will be used to populate an error envelope which is sent back instead. If the future completes with a MissingPluginException, an empty reply is sent similarly to what happens if no method call handler has been set. Any other exception results in an error envelope being sent.
Implementationvoid setMethodCallHandler(Future<dynamic> Function(MethodCall call)? handler) {
assert(
_binaryMessenger != null || BindingBase.debugBindingType() != null,
'Cannot set the method call handler before the binary messenger has been initialized. '
'This happens when you call setMethodCallHandler() before the WidgetsFlutterBinding '
'has been initialized. You can fix this by either calling WidgetsFlutterBinding.ensureInitialized() '
'before this or by passing a custom BinaryMessenger instance to MethodChannel().',
);
binaryMessenger.setMessageHandler(
name,
handler == null ? null : (ByteData? message) => _handleAsMethodCall(message, handler),
);
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4