Files
MWClash/lib/common/mixin.dart
chen08209 a1edaba5c9 Add android separates the core process
Support core status check and force restart

Update flutter and pub dependencies
2025-08-27 19:13:43 +08:00

23 lines
421 B
Dart

import 'package:riverpod/riverpod.dart';
mixin AutoDisposeNotifierMixin<T> on AnyNotifier<T, T> {
set value(T value) {
if (ref.mounted) {
state = value;
} else {
onUpdate(value);
}
}
@override
bool updateShouldNotify(previous, next) {
final res = super.updateShouldNotify(previous, next);
if (res) {
onUpdate(next);
}
return res;
}
void onUpdate(T value) {}
}