lint work

This commit is contained in:
Christien Rioux 2023-07-26 14:20:29 -04:00
parent 9e4008214d
commit 6e8725f569
43 changed files with 257 additions and 332 deletions

View file

@ -4,18 +4,17 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
// Caches a state value which can be changed from anywhere
// Creates a provider interface that notices when the value changes
class ExternalStreamState<T> {
T currentState;
StreamController<T> streamController;
ExternalStreamState(T initialState)
: currentState = initialState,
streamController = StreamController<T>.broadcast();
T currentState;
StreamController<T> streamController;
void add(T newState) {
currentState = newState;
streamController.add(newState);
}
AutoDisposeStreamProvider<T> provider() {
return AutoDisposeStreamProvider<T>((ref) async* {
AutoDisposeStreamProvider<T> provider() => AutoDisposeStreamProvider<T>((ref) async* {
if (await streamController.stream.isEmpty) {
yield currentState;
}
@ -23,5 +22,4 @@ class ExternalStreamState<T> {
yield value;
}
});
}
}