mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-25 15:35:29 -04:00
lint work
This commit is contained in:
parent
9e4008214d
commit
6e8725f569
43 changed files with 257 additions and 332 deletions
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue