-
-
Notifications
You must be signed in to change notification settings - Fork 277
null safety on sentry_flutter #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marandaneto
merged 17 commits into
getsentry:feat/null-safety
from
fzyzcjy:feat/null-safety
Mar 7, 2021
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
13eb5bf
migrate to null safety for sentry_flutter
fzyzcjy 697f41c
make it compile on dart2.12/flutter2.0
fzyzcjy 5cb2538
fix a few constructors
fzyzcjy 07fcaee
avoid WidgetsBinding.instance! as it can be null
fzyzcjy b7b8e23
remove `as FutureOr Function()`
fzyzcjy 5aeebd6
fix compile error
fzyzcjy 8550c13
remove getter/setter which are only used for null checks
fzyzcjy 9c3ccff
fixbug some warnings
fzyzcjy a443a43
generate mocks using mockito code generator
fzyzcjy 68458a8
fix bugs about "!" on null value, and return null value
fzyzcjy 20a9323
add a "when", otherwise mockito complains no stub value to return
fzyzcjy ad05773
make _observer nullable, since `call` may not be called
fzyzcjy 10247d1
add changelog
fzyzcjy 85b76b0
execute `flutter format .` on sentry-flutter
fzyzcjy fb2913a
fix analyze problems
fzyzcjy adb9c4a
change mockito version
fzyzcjy e3d8051
change signature of ensureInitialized
fzyzcjy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
generate mocks using mockito code generator
- Loading branch information
commit a443a43f74e30ddf598ffa59a66c39f1becb17cd
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| import 'package:mockito/mockito.dart'; | ||
| import 'package:mockito/annotations.dart'; | ||
| import 'package:sentry/sentry.dart'; | ||
|
|
||
| class MockHub extends Mock implements Hub {} | ||
|
|
||
| class MockTransport extends Mock implements Transport {} | ||
|
|
||
| const fakeDsn = 'https://[email protected]/1234567'; | ||
|
|
||
| @GenerateMocks([Hub, Transport]) | ||
| void main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| // Mocks generated by Mockito 5.0.0-nullsafety.7 from annotations | ||
marandaneto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // in sentry_flutter/test/mocks.dart. | ||
| // Do not manually edit this file. | ||
|
|
||
| import 'dart:async' as _i4; | ||
|
|
||
| import 'package:mockito/mockito.dart' as _i1; | ||
| import 'package:sentry/src/hub.dart' as _i3; | ||
| import 'package:sentry/src/protocol/breadcrumb.dart' as _i7; | ||
| import 'package:sentry/src/protocol/sentry_event.dart' as _i5; | ||
| import 'package:sentry/src/protocol/sentry_id.dart' as _i2; | ||
| import 'package:sentry/src/protocol/sentry_level.dart' as _i6; | ||
| import 'package:sentry/src/sentry_client.dart' as _i8; | ||
| import 'package:sentry/src/transport/transport.dart' as _i9; | ||
|
|
||
| // ignore_for_file: comment_references | ||
| // ignore_for_file: unnecessary_parenthesis | ||
|
|
||
| class _FakeSentryId extends _i1.Fake implements _i2.SentryId {} | ||
|
|
||
| class _FakeHub extends _i1.Fake implements _i3.Hub {} | ||
|
|
||
| /// A class which mocks [Hub]. | ||
| /// | ||
| /// See the documentation for Mockito's code generation for more information. | ||
| class MockHub extends _i1.Mock implements _i3.Hub { | ||
| MockHub() { | ||
| _i1.throwOnMissingStub(this); | ||
| } | ||
|
|
||
| @override | ||
| bool get isEnabled => | ||
| (super.noSuchMethod(Invocation.getter(#isEnabled), returnValue: false) | ||
| as bool); | ||
| @override | ||
| _i2.SentryId get lastEventId => | ||
| (super.noSuchMethod(Invocation.getter(#lastEventId), | ||
| returnValue: _FakeSentryId()) as _i2.SentryId); | ||
| @override | ||
| _i4.Future<_i2.SentryId> captureEvent(_i5.SentryEvent? event, | ||
| {dynamic stackTrace, dynamic hint}) => | ||
| (super.noSuchMethod( | ||
| Invocation.method( | ||
| #captureEvent, [event], {#stackTrace: stackTrace, #hint: hint}), | ||
| returnValue: | ||
| Future.value(_FakeSentryId())) as _i4.Future<_i2.SentryId>); | ||
| @override | ||
| _i4.Future<_i2.SentryId> captureException(dynamic throwable, | ||
| {dynamic stackTrace, dynamic hint}) => | ||
| (super.noSuchMethod( | ||
| Invocation.method(#captureException, [throwable], | ||
| {#stackTrace: stackTrace, #hint: hint}), | ||
| returnValue: Future.value(_FakeSentryId())) | ||
| as _i4.Future<_i2.SentryId>); | ||
| @override | ||
| _i4.Future<_i2.SentryId> captureMessage(String? message, | ||
| {_i6.SentryLevel? level, | ||
| String? template, | ||
| List<dynamic>? params, | ||
| dynamic hint}) => | ||
| (super.noSuchMethod( | ||
| Invocation.method(#captureMessage, [ | ||
| message | ||
| ], { | ||
| #level: level, | ||
| #template: template, | ||
| #params: params, | ||
| #hint: hint | ||
| }), | ||
| returnValue: Future.value(_FakeSentryId())) | ||
| as _i4.Future<_i2.SentryId>); | ||
| @override | ||
| void addBreadcrumb(_i7.Breadcrumb? crumb, {dynamic hint}) => super | ||
| .noSuchMethod(Invocation.method(#addBreadcrumb, [crumb], {#hint: hint}), | ||
| returnValueForMissingStub: null); | ||
| @override | ||
| void bindClient(_i8.SentryClient? client) => | ||
| super.noSuchMethod(Invocation.method(#bindClient, [client]), | ||
| returnValueForMissingStub: null); | ||
| @override | ||
| _i3.Hub clone() => (super.noSuchMethod(Invocation.method(#clone, []), | ||
| returnValue: _FakeHub()) as _i3.Hub); | ||
| @override | ||
| void configureScope(_i3.ScopeCallback? callback) => | ||
| super.noSuchMethod(Invocation.method(#configureScope, [callback]), | ||
| returnValueForMissingStub: null); | ||
| } | ||
|
|
||
| /// A class which mocks [Transport]. | ||
| /// | ||
| /// See the documentation for Mockito's code generation for more information. | ||
| class MockTransport extends _i1.Mock implements _i9.Transport { | ||
| MockTransport() { | ||
| _i1.throwOnMissingStub(this); | ||
| } | ||
|
|
||
| @override | ||
| _i4.Future<_i2.SentryId> send(_i5.SentryEvent? event) => (super.noSuchMethod( | ||
| Invocation.method(#send, [event]), | ||
| returnValue: Future.value(_FakeSentryId())) as _i4.Future<_i2.SentryId>); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.