didUpdateIntent method
void
didUpdateIntent({
- CorallineTerminalIntent? oldIntent,
- CorallineTerminalIntent? newIntent,
override
Intercepts incoming terminal intents to extract and couple the BuildContext provider.
oldIntent: The previously active intent, if any.newIntent: The new intent being applied to the terminal.
Ensures:
- If
newIntentis a CoralWidgetTerminalIntent, its provider's coral is coupled. - Otherwise, the internal context coupler is decoupled.
Implementation
@mustCallSuper
@override
void didUpdateIntent({
CorallineTerminalIntent? oldIntent,
CorallineTerminalIntent? newIntent,
}) {
try {
super.didUpdateIntent(oldIntent: oldIntent, newIntent: newIntent);
} catch (error, stackTrace) {
Zone.current.handleUncaughtError(error, stackTrace);
}
final finalOldIntent =
oldIntent is CoralWidgetTerminalIntent ? oldIntent : null;
final finalNewIntent =
newIntent is CoralWidgetTerminalIntent ? newIntent : null;
if (finalNewIntent != null) {
_contextCoupler.couple(finalNewIntent.contextProvider.coral);
} else {
_contextCoupler.decouple();
}
if (!identical(finalOldIntent?._context, finalNewIntent?._context)) {
didUpdateBuildContext(finalOldIntent?._context, finalNewIntent?._context);
}
}