forked from Henry-Hiles/nexus
working login
This commit is contained in:
parent
47a758a33b
commit
3fff32f170
7 changed files with 162 additions and 32 deletions
20
lib/controllers/multi_provider_controller.dart
Normal file
20
lib/controllers/multi_provider_controller.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import "dart:async";
|
||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
class MultiProviderController extends AsyncNotifier<void> {
|
||||
MultiProviderController(this.providers);
|
||||
final IList<AsyncNotifierProvider> providers;
|
||||
|
||||
@override
|
||||
FutureOr<void> build() async => await Future.wait(
|
||||
providers.map((provider) => ref.watch(provider.future)),
|
||||
);
|
||||
|
||||
static final provider =
|
||||
AsyncNotifierProvider.family<
|
||||
MultiProviderController,
|
||||
void,
|
||||
IList<AsyncNotifierProvider>
|
||||
>(MultiProviderController.new);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue