feat: provide CallController as singleton via RepositoryProvider in MainShell#1000
Open
feat: provide CallController as singleton via RepositoryProvider in MainShell#1000
Conversation
…ainShell Register CallController once in MainShell widget tree after CallBloc, CallRoutingCubit and NotificationsBloc are available. All seven call sites now obtain the shared instance via late final field initializer (context.read<CallController>()) instead of constructing a new object per StatefulWidget.
…dget RepositoryProvider is semantically for the data layer; CallController is a UI-tier coordinator. Introduce CallControllerScope (InheritedWidget) following the PresenceViewParams pattern already in the codebase. All seven consumers now resolve the controller via CallControllerScope.of(context).
Store CallController in _MainShellState via ??= so it is created once regardless of how many times build() reruns. Switch CallControllerScope.of to getElementForInheritedWidgetOfExactType to avoid registering a rebuild dependency that would never fire (updateShouldNotify is always false).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
CallControllerScope(InheritedWidget) following thePresenceViewParamspattern already in the codebase — semantically correct alternative toRepositoryProviderfor a UI-tier coordinatorCallControllerinstance inMainShell(stored in_MainShellStatevia??=to survive rebuilds) and expose it viaCallControllerScopeStatenow caches the shared instance withlate final _callController = CallControllerScope.of(context)NotificationsBloc,notifications.dart) from affected filesTest plan
call_controller_test.dart(8 tests) — all pass