GlobalBlocResolver class

Global resolver for managing bloc dependencies throughout the application.

The GlobalBlocResolver provides a central point for resolving bloc instances. It can work with different dependency injection systems by accepting any implementation of BlocDependencyResolver.

Example usage with default resolver:

void main() {
  GlobalBlocResolver().resolver = BlocResolver();
  runApp(MyApp());
}

Example with FlutterModular:

void main() {
  GlobalBlocResolver().resolver = ModularBlocResolver();
  runApp(ModularApp(module: AppModule()));
}

Example with composite resolvers:

void main() {
  GlobalBlocResolver().resolver = CompositeResolver({
    AuthBloc: AuthBlocResolver(),
    FeatureBloc: FeatureBlocResolver(),
  });
  runApp(MyApp());
}

Constructors

GlobalBlocResolver()
Factory constructor that returns the singleton instance
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
resolver BlocDependencyResolver
The active bloc dependency resolver
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

resolve<T extends JuiceBloc<BlocState>>() → T
Resolves a bloc of the specified type using the configured resolver