Skip to content

Commit

Permalink
[firebase_crashlytics] Updates the example with the missing "recordEr…
Browse files Browse the repository at this point in the history
…ror". (firebase#1663) (firebase#1665)

* Updates the example with the missing "recordError". (firebase#1663)
  • Loading branch information
feinstein authored and collinjackson committed Dec 17, 2019
1 parent d28d870 commit bcd503a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/firebase_crashlytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.1.2+4

* Updated the example with the missing `recordError()` method.
* Added a `recordError()` integration test.

## 0.1.2+3

* Remove the deprecated `author:` field from pubspec.yaml
Expand Down
12 changes: 12 additions & 0 deletions packages/firebase_crashlytics/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ class _MyAppState extends State<MyApp> {
print(list[100]);
});
}),
FlatButton(
child: const Text('Record Error'),
onPressed: () {
try {
throw 'error_example';
} catch (e, s) {
// "context" will append the word "thrown" in the
// Crashlytics console.
Crashlytics.instance
.recordError(e, s, context: 'as an example');
}
}),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,10 @@ void main() {
DiagnosticsNode.message('testing'),
DiagnosticsNode.message('information'),
]));
await crashlytics.recordError(
'exception_text',
StackTrace.fromString('during testing'),
context: 'during testing example',
);
});
}
2 changes: 1 addition & 1 deletion packages/firebase_crashlytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: firebase_crashlytics
description:
Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the
Firebase console.
version: 0.1.2+3
version: 0.1.2+4
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_crashlytics

environment:
Expand Down

0 comments on commit bcd503a

Please sign in to comment.