BlocLifecycle enum

Defines the lifecycle behavior for a bloc instance.

The lifecycle determines when a bloc is created and disposed, enabling semantic correctness rather than cache-based eviction.

Inheritance
Available extensions

Values

permanent → const BlocLifecycle

Lives for entire app lifetime. Never auto-disposed.

Use for app-wide blocs that should persist throughout the application's lifecycle.

Examples: AuthBloc, SettingsBloc, AppBloc, ThemeBloc

feature → const BlocLifecycle

Lives for a feature/flow. Disposed when FeatureScope ends.

Use for blocs that belong to a specific feature or user flow and should be disposed when that flow completes.

Examples: CheckoutBloc, OnboardingBloc, WizardBloc

leased → const BlocLifecycle

Lives while leases exist. Auto-disposed when last lease releases.

Use for UI-specific blocs that should only exist while widgets are actively using them.

Examples: FormBloc, SearchBloc, ItemDetailBloc

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
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

Constants

values → const List<BlocLifecycle>
A constant List of the values in this enum, in order of their declaration.