setup static method
Implementation
static void setup(WindowStateEventApi? api, {BinaryMessenger? binaryMessenger}) {
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.liquid_flutter_window_utils.WindowStateEventApi.onWindowStateChanged', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.liquid_flutter_window_utils.WindowStateEventApi.onWindowStateChanged was null.');
final List<Object?> args = (message as List<Object?>?)!;
final WindowState? arg_state = (args[0] as WindowState?);
assert(arg_state != null,
'Argument for dev.flutter.pigeon.liquid_flutter_window_utils.WindowStateEventApi.onWindowStateChanged was null, expected non-null WindowState.');
try {
api.onWindowStateChanged(arg_state!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.liquid_flutter_window_utils.WindowStateEventApi.onWindowReady', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
channel.setMessageHandler(null);
} else {
channel.setMessageHandler((Object? message) async {
try {
api.onWindowReady();
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
}