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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user