refactors (#539)

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-08-16 01:24:43 +08:00
committed by GitHub
parent 7e5bb54c98
commit 38366a2ef3
45 changed files with 527 additions and 640 deletions

View File

@@ -0,0 +1,20 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
abstract class Provider<T> {
const Provider();
/// (Re)Load data from store / network / etc.
@mustCallSuper
FutureOr<void> load() {
all.add(this);
debugPrint('$runtimeType added');
}
static final all = <Provider>[];
static Future<void> reload() {
return Future.wait(all.map((e) async => await e.load()));
}
}