FrChangeNotifierMx<M> mixin
only for adapt Provider-Consumer
class YourOldViewModel extends FrViewModel<OldModel> with ChangeNotifier, ChangeNotifierMx{
// ... keep old code , but add value fields getter, setter...
// see `test/mvvm/mixin/change_notifier.dart`
}
Consumer<YourOldViewModel>(
// ... you can keep old Provider code ...
)
- Superclass constraints
- Mixin applications
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- initValue → M
-
when
_subjectinit, get seed valueno setterinherited - logExtra → LogExtra?
-
set put log type
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
slowly
→ Slowly<
Object> -
no setterinherited
-
stream
↔ ValueStream<
M> -
subject.streamgetter/setter pairinherited -
subject
→ BehaviorSubject<
M> -
no setterinherited
- value → M
-
subject.valueno setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
autoDispose<
T extends StreamSubscription?> (T subs, {String? tag}) → T -
inherited
-
autoDisposeNotifier<
N extends ChangeNotifier?> (N ntf, {String? tag}) → N -
inherited
-
debounceMs<
R> (Object tag, R func, {int ms = 200}) → Future< R?> -
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
dispose(
) → void -
inherited
-
frPrint(
String message, {DateTime? time, int? sequenceNumber, int? level, String? name, Zone? zone, Object? error, StackTrace? stackTrace}) → dynamic -
inherited
-
listen(
void onChange(T ntf)?, {bool where(T ntf)?}) → T -
Available on T, provided by the ChangeNotifierX extension
wherefilter the notification, -
logger(
String message, {LogExtra? logExtra = !kReleaseMode ? LogExtra.self : null, bool uriFrame = false, DateTime? time, int? sequenceNumber, int level = 0, String? name, Zone? zone, Object? error, StackTrace? stackTrace}) → dynamic -
logExtraprint stack frame infonamelogger.name null: and iflogExtra==null: will use 'runtimeType' else: will use stack frame infostackTracewill print with red color by dev.log but iferror== null: will ignorestackTraceinherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
[FutureOr< M> update(M old)?]) → void -
when invoke FrChangeNotifierMx.notifyListeners
must invoke
update(put)override -
ntfBy<
T extends ChangeNotifier> (String tag) → T -
inherited
-
put(
M value) → M -
when invoke update (put)
will call ChangeNotifier.notifyListeners
override
-
putError(
Object error, [StackTrace? stackTrace]) → void -
put error value to
_subjectinherited -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
runCatching<
R> (FutureOr< R?> block(), {FutureOr<R?> onSuccess(R data)?, FutureOr<R?> onFailure(Object e, StackTrace s)?, dynamic ignoreSkipError = true}) → FutureOr<R?> -
run and catch error, then putError
inherited
-
skpIf(
bool condition, String reason) → void -
if you want interrupt the normal flow, but not trigger
runCatching.onFailureinherited -
skpIfNull(
Object? obj, String reason) → void -
if
obj==null, throw SkipError ref skpIfinherited -
skpNull<
T> (T? obj, String reason) → T -
if
obj== null: throw SkipError else: returnobj!inherited -
subBy<
T extends StreamSubscription> (String tag) → T -
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
-
update(
FutureOr< M> update(M old), {dynamic onError(Object e, StackTrace s)?, int slowlyMs = 100, Object? debounceTag, Object? throttleTag, dynamic ignoreSkipError = true}) → FutureOr<M?> -
updateif return value, will callputif return null, will not callput/putErroronErrorif set null,will callputErrorif set function value, will not callputError, you can invokeputErrormanuallyslowlyMsif set <=0 value, will ignore debounce/throttleTagdebounceTagenable debounce, require unique within the VM scopethrottleTagenable throttle, require unique within the VM scopeignoreSkipErrorrefrunCatching.ignoreSkipErrorinherited -
updateRaw(
FutureOr< M> up(M old), {dynamic onError(Object e, StackTrace s)?, int slowlyMs = 100, Object? debounceTag, Object? throttleTag, dynamic ignoreSkipError = true}) → FutureOr<M?> -
Deprecated use 'update'
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited