Add sqlite store

Optimize android quick action

Optimize backup and restore

Optimize more details
This commit is contained in:
chen08209
2025-12-16 11:23:09 +08:00
parent 243b3037d9
commit 2fbb96f5c1
214 changed files with 15659 additions and 10751 deletions

View File

@@ -2,17 +2,21 @@ import 'package:riverpod/riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
mixin AutoDisposeNotifierMixin<T> on AnyNotifier<T, T> {
T get value => state;
set value(T value) {
if (ref.mounted) {
state = value;
} else {
onUpdate(value);
}
state = value;
}
bool equals(T previous, T next) {
return false;
}
@override
bool updateShouldNotify(previous, next) {
final res = super.updateShouldNotify(previous, next);
final res = !equals(previous, next)
? super.updateShouldNotify(previous, next)
: true;
if (res) {
onUpdate(next);
}
@@ -21,31 +25,19 @@ mixin AutoDisposeNotifierMixin<T> on AnyNotifier<T, T> {
void onUpdate(T value) {}
void update(T Function(T) builder) {
final value = builder(state);
this.value = value;
void update(T? Function(T) builder) {
final res = builder(value);
if (res == null) {
return;
}
value = res;
}
}
mixin AnyNotifierMixin<T> on AnyNotifier<T, T> {
mixin AsyncNotifierMixin<T> on AnyNotifier<AsyncValue<T>, T> {
T get value;
set value(T value) {
if (ref.mounted) {
state = value;
} else {
onUpdate(value);
}
state = AsyncData(value);
}
@override
bool updateShouldNotify(previous, next) {
final res = super.updateShouldNotify(previous, next);
if (res) {
onUpdate(next);
}
return res;
}
void onUpdate(T value) {}
}