Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/firebase_crashlytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.0.4+9

* Fixed custom keys implementation.
* Added tests for custom keys implementation.
* Removed a print statement.

## 0.0.4+8

* Automatically use version from pubspec.yaml when reporting usage to Firebase.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ void main() {

test('onError', () async {
// This is currently only testing that we can log errors without crashing.
await Crashlytics.instance.setUserName('testing');
await Crashlytics.instance.setUserIdentifier('hello');
final Crashlytics crashlytics = Crashlytics.instance;
await crashlytics.setUserName('testing');
await crashlytics.setUserIdentifier('hello');
crashlytics.setBool('testBool', true);
crashlytics.setInt('testInt', 42);
crashlytics.setDouble('testDouble', 42.0);
crashlytics.setString('testString', 'bar');
Crashlytics.instance.log('testing');
await Crashlytics.instance.onError(
await crashlytics.onError(
FlutterErrorDetails(
exception: 'testing',
stack: StackTrace.fromString(''),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class Crashlytics {
'logs': _logs.toList(),
'keys': _prepareKeys(),
});
print(result);
}
}

Expand Down Expand Up @@ -156,6 +155,7 @@ class Crashlytics {
} else if (value is bool) {
crashlyticsKey['type'] = 'boolean';
}
crashlyticsKeys.add(crashlyticsKey);
}

return crashlyticsKeys;
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_crashlytics/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: firebase_crashlytics
description: Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the
Firebase console.
version: 0.0.4+8
version: 0.0.4+9
author: Flutter Team <flutter-dev@google.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_crashlytics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,28 @@ void main() {
);
crashlytics.enableInDevMode = true;
crashlytics.log('foo');
crashlytics.setBool('testBool', true);
crashlytics.setInt('testInt', 42);
crashlytics.setDouble('testDouble', 42.0);
crashlytics.setString('testString', 'bar');
await crashlytics.onError(details);
expect(log[0].method, 'Crashlytics#onError');
expect(log[0].arguments['exception'], 'foo exception');
expect(log[0].arguments['context'], 'foo context');
expect(log[0].arguments['logs'], isNotEmpty);
expect(log[0].arguments['logs'], contains('foo'));
expect(log[0].arguments['keys'], isEmpty);
expect(log[0].arguments['keys'][0]['key'], 'testBool');
expect(log[0].arguments['keys'][0]['value'], isTrue);
expect(log[0].arguments['keys'][0]['type'], 'boolean');
expect(log[0].arguments['keys'][1]['key'], 'testInt');
expect(log[0].arguments['keys'][1]['value'], 42);
expect(log[0].arguments['keys'][1]['type'], 'int');
expect(log[0].arguments['keys'][2]['key'], 'testDouble');
expect(log[0].arguments['keys'][2]['value'], 42.0);
expect(log[0].arguments['keys'][2]['type'], 'double');
expect(log[0].arguments['keys'][3]['key'], 'testString');
expect(log[0].arguments['keys'][3]['value'], 'bar');
expect(log[0].arguments['keys'][3]['type'], 'string');
});

test('isDebuggable', () async {
Expand Down