ChangeNotifierProvider<Notifier extends ChangeNotifier?> class Null safety

Creates a ChangeNotifier and subscribes to it.

Note: By using Riverpod, ChangeNotifier will no-longer be O(N^2) for dispatching notifications, but instead O(N)

Inheritance
Annotations

Constructors

ChangeNotifierProvider(Create<Notifier, ChangeNotifierProviderRef<Notifier>> create, {String? name, List<ProviderOrFamily>? dependencies, Family<dynamic, dynamic, ProviderBase>? from, Object? argument})
Creates a ChangeNotifier and subscribes to it.

Properties

allTransitiveDependencies List<ProviderOrFamily>?
All the dependencies of a provider and their dependencies too.
late, final, inherited
argument Object?
If this provider was created with the .family modifier, argument is variable used.
final, inherited
dependencies List<ProviderOrFamily>?
The list of providers that this provider potentially depends on.
late, final, inherited
from Family<dynamic, dynamic, ProviderBase>?
If this provider was created with the .family modifier, from is the .family instance.
final, inherited
hashCode int
The hash code for this object.
read-only, inherited
name String?
A custom label for providers.
final, inherited
notifier AlwaysAliveProviderBase<Notifier>
Obtains the ChangeNotifier associated with this provider, but without listening to it.
final
originProvider ProviderBase<Notifier>
The provider that will be refreshed when calling ProviderContainer.refresh and that will be overridden when passed to ProviderScope.
read-only, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

create(covariant ProviderElementBase<Notifier> ref) → Notifier
Initializes the state of a provider
override
createElement() ProviderElement<Notifier>
An internal method that defines how a provider behaves.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
overrideWithProvider(ChangeNotifierProvider<Notifier> value) Override
Overrides a provider with a value, ejecting the default behaviour.
inherited
overrideWithValue(Notifier value) Override
Overrides a provider with a value, ejecting the default behaviour.
inherited
select<Selected>(Selected selector(Notifier value)) AlwaysAliveProviderListenable<Selected>
Partially listen to a provider.
inherited
toString() String
A string representation of this object.
inherited
updateShouldNotify(Notifier previousState, Notifier newState) bool
Called when a provider is rebuilt. Used for providers to not notify their listeners if the exposed value did not change.
override

Operators

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

Constants

autoDispose → const AutoDisposeChangeNotifierProviderBuilder
Marks the provider as automatically disposed when no-longer listened.
AutoDisposeChangeNotifierProviderBuilder()
family → const ChangeNotifierProviderFamilyBuilder
A group of providers that builds their value from an external parameter.
ChangeNotifierProviderFamilyBuilder()