1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 23:08:59 +00:00

[platform_channels] Migrate to sound null safety (#803)

This commit is contained in:
Ayush Bherwani
2021-06-08 04:00:12 +05:30
committed by GitHub
parent c8112c88ac
commit 865c545f3d
15 changed files with 50 additions and 46 deletions

View File

@@ -19,8 +19,8 @@ void main() {
// calls the BinaryMessenger.setMessageHandler registered for the EventChannel
// and add the incoming message to the StreamController used by the EventChannel
// after decoding the message with codec used by the EventChannel.
void emitValues(ByteData event) {
ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
void emitValues(ByteData? event) {
ServicesBinding.instance?.defaultBinaryMessenger.handlePlatformMessage(
'eventChannelDemo',
event,
(reply) {},
@@ -29,7 +29,7 @@ void main() {
// Register a mock for EventChannel. EventChannel under the hood uses
// MethodChannel to listen and cancel the created stream.
ServicesBinding.instance.defaultBinaryMessenger
ServicesBinding.instance?.defaultBinaryMessenger
.setMockMessageHandler('eventChannelDemo', (message) async {
// Decode the message into MethodCallHandler.
final methodCall = standardMethod.decodeMethodCall(message);