Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
c06dce47
Commit
c06dce47
authored
May 26, 2017
by
Mikkel Nygaard Ravn
Committed by
GitHub
May 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more docs for MethodChannel.invokeMethod (#10345)
parent
c11d1318
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
message_codecs.dart
packages/flutter/lib/src/services/message_codecs.dart
+0
-4
platform_channel.dart
packages/flutter/lib/src/services/platform_channel.dart
+16
-2
No files found.
packages/flutter/lib/src/services/message_codecs.dart
View file @
c06dce47
...
...
@@ -164,10 +164,6 @@ class JSONMethodCodec implements MethodCodec {
/// [MessageCodec] using the Flutter standard binary encoding.
///
/// The standard encoding is guaranteed to be compatible with the corresponding
/// standard codec for FlutterMessageChannels on the host platform. These parts
/// of the Flutter SDK are evolved synchronously.
///
/// Supported messages are acyclic values of these forms:
///
/// * null
...
...
packages/flutter/lib/src/services/platform_channel.dart
View file @
c06dce47
...
...
@@ -17,7 +17,7 @@ import 'platform_messages.dart';
/// Messages are encoded into binary before being sent, and binary messages
/// received are decoded into Dart values. The [MessageCodec] used must be
/// compatible with the one used by the platform plugin. This can be achieved
/// by creating a
[BasicMessageChannel]
counterpart of this channel on the
/// by creating a
basic message channel
counterpart of this channel on the
/// platform side. The Dart type of messages sent and received is [T],
/// but only the values supported by the specified [MessageCodec] can be used.
/// The use of unsupported values should be considered programming errors, and
...
...
@@ -95,7 +95,7 @@ class BasicMessageChannel<T> {
/// Method calls are encoded into binary before being sent, and binary results
/// received are decoded into Dart values. The [MethodCodec] used must be
/// compatible with the one used by the platform plugin. This can be achieved
/// by creating a
`MethodChannel`
counterpart of this channel on the
/// by creating a
method channel
counterpart of this channel on the
/// platform side. The Dart type of arguments and results is `dynamic`,
/// but only values supported by the specified [MethodCodec] can be used.
/// The use of unsupported values should be considered programming errors, and
...
...
@@ -123,12 +123,26 @@ class MethodChannel {
/// Invokes a [method] on this channel with the specified [arguments].
///
/// The static type of [arguments] is `dynamic`, but only values supported by
/// the [codec] of this channel can be used. The same applies to the returned
/// result. The values supported by the default codec and their platform-specific
/// counterparts are documented with [StandardMessageCodec].
///
/// Returns a [Future] which completes to one of the following:
///
/// * a result (possibly null), on successful invocation;
/// * a [PlatformException], if the invocation failed in the platform plugin;
/// * a [MissingPluginException], if the method has not been implemented by a
/// platform plugin.
///
/// See also:
///
/// * [StandardMessageCodec] which defines the payload values supported by
/// [StandardMethodCodec].
/// * [JSONMessageCodec] which defines the payload values supported by
/// [JSONMethodCodec].
/// * <https://docs.flutter.io/javadoc/io/flutter/plugin/common/MethodCall.html>
/// for how to access method call arguments on Android.
Future
<
dynamic
>
invokeMethod
(
String
method
,
[
dynamic
arguments
])
async
{
assert
(
method
!=
null
);
final
dynamic
result
=
await
BinaryMessages
.
send
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment