Created with <3 with dartpad.dev.
Created
January 10, 2024 08:47
-
-
Save icnahom/4357e6bc7b20908eaf40ba8b1585f804 to your computer and use it in GitHub Desktop.
zealous-pool-3944
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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