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
c849ffd3
Unverified
Commit
c849ffd3
authored
Apr 27, 2020
by
Kate Lovett
Committed by
GitHub
Apr 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FlutterErrorDetails.context docs fix (#55001)
parent
26516817
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
8 deletions
+66
-8
assertions.dart
packages/flutter/lib/src/foundation/assertions.dart
+66
-8
No files found.
packages/flutter/lib/src/foundation/assertions.dart
View file @
c849ffd3
...
...
@@ -10,6 +10,9 @@ import 'diagnostics.dart';
import
'print.dart'
;
import
'stack_frame.dart'
;
// Examples can assume:
// String runtimeType;
/// Signature for [FlutterError.onError] handler.
typedef
FlutterExceptionHandler
=
void
Function
(
FlutterErrorDetails
details
);
...
...
@@ -281,7 +284,7 @@ class ErrorSummary extends _ErrorDiagnostic {
/// An [ErrorHint] provides specific, non-obvious advice that may be applicable.
///
/// If your message provides obvious advice that is always applicable it is an
/// If your message provides obvious advice that is always applicable
,
it is an
/// [ErrorDescription] not a hint.
///
/// See also:
...
...
@@ -325,7 +328,30 @@ class ErrorSpacer extends DiagnosticsProperty<void> {
/// Class for information provided to [FlutterExceptionHandler] callbacks.
///
/// See [FlutterError.onError].
/// {@tool snippet}
/// This is an example of using [FlutterErrorDetails] when calling
/// [FlutterError.reportError].
///
/// ```dart
/// void main() {
/// try {
/// // Try to do something!
/// } catch (error) {
/// // Catch & report error.
/// FlutterError.reportError(FlutterErrorDetails(
/// exception: error,
/// library: 'Flutter test framework',
/// context: ErrorSummary('while running async test code'),
/// ));
/// }
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [FlutterError.onError], which is called whenever the Flutter framework
/// catches an error
class
FlutterErrorDetails
with
Diagnosticable
{
/// Creates a [FlutterErrorDetails] object with the given arguments setting
/// the object's properties.
...
...
@@ -382,13 +408,45 @@ class FlutterErrorDetails with Diagnosticable {
/// the console.
final
String
library
;
/// A human-readable description of where the error was caught (as opposed to
/// where it was thrown).
/// A [DiagnosticsNode] that provides a human-readable description of where
/// the error was caught (as opposed to where it was thrown).
///
/// The node, e.g. an [ErrorDescription], should be in a form that will make
/// sense in English when following the word "thrown", as in "thrown while
/// obtaining the image from the network" (for the context "while obtaining
/// the image from the network").
///
/// {@tool snippet}
/// This is an example of using and [ErrorDescription] as the
/// [FlutterErrorDetails.context] when calling [FlutterError.reportError].
///
/// ```dart
/// void maybeDoSomething() {
/// try {
/// // Try to do something!
/// } catch (error) {
/// // Catch & report error.
/// FlutterError.reportError(FlutterErrorDetails(
/// exception: error,
/// library: 'Flutter test framework',
/// context: ErrorDescription('while dispatching notifications for $runtimeType'),
/// ));
/// }
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
/// The string should be in a form that will make sense in English when
/// following the word "thrown", as in "thrown while obtaining the image from
/// the network" (for the context "while obtaining the image from the
/// network").
/// * [ErrorDescription], which provides an explanation of the problem and
/// its cause, any information that may help track down the problem,
/// background information, etc.
/// * [ErrorSummary], which provides a short (one line) description of the
/// problem that was detected.
/// * [ErrorHint], which provides specific, non-obvious advice that may be
/// applicable.
/// * [FlutterError], which is the most common place to use
/// [FlutterErrorDetails].
final
DiagnosticsNode
context
;
/// A callback which filters the [stack] trace. Receives an iterable of
...
...
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