-
Notifications
You must be signed in to change notification settings - Fork 8
Listeners renamed into observers #19
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d724d2f
listeners renamed to observers
aNOOBisTheGod b862e91
proper code formatting
aNOOBisTheGod 556fd39
missing commits added
aNOOBisTheGod 4584257
proper files formatting
aNOOBisTheGod 20196f0
issues fixed
aNOOBisTheGod 2494500
deprecated ignore added for each line
aNOOBisTheGod 17528f7
deprecation added to CoreScopeHolder, main function for listener extr…
aNOOBisTheGod b777722
asyncDepListener/Observer added to example class, listener super para…
aNOOBisTheGod 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| import 'package:yx_scope/yx_scope.dart'; | ||
| import './main.dart'; | ||
|
|
||
| class AppScopeHolderWithListener extends ScopeHolder<AppScopeContainer> { | ||
| static const _listener = AppListener(); | ||
|
|
||
| AppScopeHolderWithListener() | ||
| // ignore: deprecated_member_use | ||
| : super(scopeListeners: [_listener], depListeners: [_listener]); | ||
|
|
||
| @override | ||
| AppScopeContainer createContainer() => AppScopeContainer(); | ||
| } | ||
|
|
||
| // ignore: deprecated_member_use | ||
| class AppListener implements ScopeListener, DepListener, AsyncDepListener { | ||
| const AppListener(); | ||
|
|
||
| static void _log( | ||
| String message, [ | ||
| Object? exception, | ||
| StackTrace? stackTrace, | ||
| ]) { | ||
| print(message); | ||
| if (exception != null) { | ||
| print(exception); | ||
| if (stackTrace != null) { | ||
| print(stackTrace); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @override | ||
| void onScopeStartInitialize(ScopeId scope) => | ||
| _log('[$scope] -> onScopeStartInitialize'); | ||
|
|
||
| @override | ||
| void onScopeInitialized(ScopeId scope) => | ||
| _log('[$scope] -> onScopeInitialized'); | ||
|
|
||
| @override | ||
| void onScopeInitializeFailed( | ||
| ScopeId scope, | ||
| Object exception, | ||
| StackTrace stackTrace, | ||
| ) => | ||
| _log('[$scope] -> onScopeInitializeFailed', exception, stackTrace); | ||
|
|
||
| @override | ||
| void onScopeStartDispose(ScopeId scope) => | ||
| _log('[$scope] -> onScopeStartDispose'); | ||
|
|
||
| @override | ||
| void onScopeDisposed(ScopeId scope) => _log('[$scope] -> onScopeDisposed'); | ||
|
|
||
| @override | ||
| void onScopeDisposeDepFailed( | ||
| ScopeId scope, | ||
| DepId dep, | ||
| Object exception, | ||
| StackTrace stackTrace, | ||
| ) => | ||
| _log('[$scope] -> onScopeDisposeDepFailed', exception, stackTrace); | ||
|
|
||
| @override | ||
| void onValueStartCreate(ScopeId scope, DepId dep) => | ||
| _log('[$scope.$dep] -> onValueStartCreate'); | ||
|
|
||
| @override | ||
| void onValueCreated(ScopeId scope, DepId dep, ValueMeta? valueMeta) => | ||
| _log('[$scope.$dep] -> onValueCreated'); | ||
|
|
||
| @override | ||
| void onValueCreateFailed( | ||
| ScopeId scope, | ||
| DepId dep, | ||
| Object exception, | ||
| StackTrace stackTrace, | ||
| ) => | ||
| _log('[$scope.$dep] -> onValueCreated', exception, stackTrace); | ||
|
|
||
| @override | ||
| void onValueCleared(ScopeId scope, DepId dep, ValueMeta? valueMeta) => | ||
| _log('[$scope.$dep]($valueMeta) -> onValueCleared'); | ||
|
|
||
| @override | ||
| void onDepDisposeFailed( | ||
| ScopeId scope, DepId dep, Object exception, StackTrace stackTrace) => | ||
| _log('[$scope.$dep] -> onDepDisposeFailed', exception, stackTrace); | ||
|
|
||
| @override | ||
| void onDepDisposed(ScopeId scope, DepId dep) => | ||
| _log('[$scope.$dep] -> onDepDisposed'); | ||
|
|
||
| @override | ||
| void onDepInitializeFailed( | ||
| ScopeId scope, DepId dep, Object exception, StackTrace stackTrace) => | ||
| _log('[$scope.$dep] -> onDepInitializeFailed', exception, stackTrace); | ||
|
|
||
| @override | ||
| void onDepInitialized(ScopeId scope, DepId dep) => | ||
| _log('[$scope.$dep] -> onDepInitialized'); | ||
|
|
||
| @override | ||
| void onDepStartDispose(ScopeId scope, DepId dep) => | ||
| _log('[$scope.$dep] -> onDepStartDispose'); | ||
|
|
||
| @override | ||
| void onDepStartInitialize(ScopeId scope, DepId dep) => | ||
| _log('[$scope.$dep] -> onDepStartInitialize'); | ||
| } |
15 changes: 15 additions & 0 deletions
15
packages/yx_scope/example/bin/deprecated_listeners_main.dart
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,15 @@ | ||
| import 'app_listener.dart'; | ||
|
|
||
| /// This file will be deleted in the next major version | ||
| /// when Listeners will be completely removed | ||
| void main() async { | ||
| final appScopeHolderWithListener = AppScopeHolderWithListener(); | ||
|
|
||
| await appScopeHolderWithListener.create(); | ||
|
|
||
| print(appScopeHolderWithListener.scope?.routerDelegateDep.get); | ||
|
|
||
| await appScopeHolderWithListener.drop(); | ||
|
|
||
| print(appScopeHolderWithListener.scope?.routerDelegateDep.get); | ||
| } |
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 +1 @@ | ||
| export 'src/monitoring/raw_listeners.dart'; | ||
| export 'src/monitoring/raw_observers.dart'; |
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
Oops, something went wrong.
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.