cubit property

T get cubit

Returns the BLoC instance associated with this view.

This getter automatically retrieves the appropriate BLoC instance from the dependency injection system based on the generic type T.

Returns

An instance of type T that extends Cubit

Throws

  • Exception if the BLoC instance is not registered in the dependency injector

Example

// Access the cubit instance
final paymentCubit = cubit;

// Use the cubit for actions
paymentCubit.processPayment(amount: 100.0);

// Listen to state changes
paymentCubit.stream.listen((state) {
  print('State changed: $state');
});

Implementation

T get cubit => WalletInjector.instance.getIt.get<T>();