Skip to content

Instantly share code, notes, and snippets.

@icnahom
Created January 10, 2024 08:47
Show Gist options
  • Save icnahom/4357e6bc7b20908eaf40ba8b1585f804 to your computer and use it in GitHub Desktop.
Save icnahom/4357e6bc7b20908eaf40ba8b1585f804 to your computer and use it in GitHub Desktop.
zealous-pool-3944
void main() {
final todos = signal([]);
print(todos.isEmpty);
final messages = signal({});
print(messages.keys);
}
Signal<T> signal<T>(T value) => Signal(value);
class Signal<T> {
const Signal(this.value);
final T value;
}
extension ListSignalExtension<E> on Signal<List<E>> {
bool get isEmpty => value.isEmpty;
}
extension MapSignalExtension<K, V> on Signal<Map<K, V>> {
Iterable<K> get keys => value.keys;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment