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
f9ac22a4
Unverified
Commit
f9ac22a4
authored
May 31, 2022
by
Jonas Uekötter
Committed by
GitHub
May 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve `PlatformException#stacktrace` docs for Android (#104331)
parent
bb30bfdd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
message_codec.dart
packages/flutter/lib/src/services/message_codec.dart
+45
-0
No files found.
packages/flutter/lib/src/services/message_codec.dart
View file @
f9ac22a4
...
...
@@ -145,6 +145,51 @@ class PlatformException implements Exception {
/// print(stacktrace);
/// }
/// ```
///
/// On Android this field is populated when a `RuntimeException` or a subclass of it is thrown in the method call handler,
/// as shown in the following example:
///
/// ```kotlin
/// import androidx.annotation.NonNull
/// import io.flutter.embedding.android.FlutterActivity
/// import io.flutter.embedding.engine.FlutterEngine
/// import io.flutter.plugin.common.MethodChannel
///
/// class MainActivity: FlutterActivity() {
/// private val CHANNEL = "channel_name"
///
/// override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
/// super.configureFlutterEngine(flutterEngine)
/// MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
/// call, result -> throw RuntimeException("Oh no")
/// }
/// }
/// }
/// ```
///
/// It is also populated on Android if the method channel result is not serializable.
/// If the result is not serializable, an exception gets thrown during the serialization process.
/// This can be seen in the following example:
///
/// ```kotlin
/// import androidx.annotation.NonNull
/// import io.flutter.embedding.android.FlutterActivity
/// import io.flutter.embedding.engine.FlutterEngine
/// import io.flutter.plugin.common.MethodChannel
///
/// class MainActivity: FlutterActivity() {
/// private val CHANNEL = "channel_name"
///
/// override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
/// super.configureFlutterEngine(flutterEngine)
/// MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
/// call, result -> result.success(Object())
/// }
/// }
/// }
/// ```
///
/// In the cases described above, the content of [stacktrace] will be the unprocessed output of calling `toString()` on the exception.
final
String
?
stacktrace
;
@override
...
...
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