Skip to content

Update documentation to note that null bytes are disallowed in method channel names. #116652

Closed
flutter/engine
#43593
@Lyokone

Description

Steps to Reproduce

Linked to firebase/flutterfire#9587

In FlutterFire, we are using channels with arbitrary names to listen to events emitted by native.
It appears that using a channel that has a Unicode character; the channel will fail with

MissingPluginException (MissingPluginException(No implementation found for method getPlatformVersion on channel hello))

Expected results:
We should be able to use Unicode characters in MethodChannels.

Actual results:

MissingPluginException (MissingPluginException(No implementation found for method getPlatformVersion on channel hello))
Code sample

By using `flutter create --org com.example --template=plugin --platforms=android,ios,linux,macos,windows -a kotlin hello``

And changing hello_method_channel.dart:10

final methodChannel = const MethodChannel('hello\u{0000}');

And android/src/main/kotlin/com/example/hello/HelloPlugin.kt:20 with

channel = MethodChannel(flutterPluginBinding.binaryMessenger, "hello\u0000")

You will get the issue.

Logs
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.9, on macOS 13.0 22A380 darwin-arm, locale en-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

Metadata

Assignees

Labels

P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/engineflutter/engine repository. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions