PingoraExtension extension
Extension on BuildContext providing convenient access to Pingora controllers that are scoped via PingoraScope ancestors in the widget tree.
Usage
// Inside any widget that is a child of PingoraScope<CounterModel>:
// Get the model and subscribe to updates
final model = context.pingora<CounterModel>();
model.subscribe(_onUpdate);
// Trigger a ping to all listeners
model.increment(); // internally calls ping()
// Unsubscribe when done
model.unsubscribe(_onUpdate);
- on
Methods
-
pingora<
T extends Pingora> () → T -
Available on BuildContext, provided by the PingoraExtension extension
Retrieves the nearest Pingora instance of typeTfrom an ancestor PingoraScope in the widget tree.