This file contains hidden or 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
| https://github.com/flutter/flutter/issues/18636 |
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| import 'package:flutter_hooks/flutter_hooks.dart'; | |
| import 'package:signals/signals_flutter.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends HookWidget { | |
| const MyApp({super.key}); |
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| import 'dart:async'; | |
| import 'package:signals_flutter/signals_flutter.dart'; | |
| import 'package:flutter_hooks/flutter_hooks.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| Future<int> fetchUser(int id) async { |
This file contains hidden or 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
| import 'package:signals/signals.dart'; | |
| void main() async { | |
| final number = signal(2); | |
| final squared = computedAsync(() async { | |
| print("Squaring ${number.value}..."); | |
| await Future.delayed(Duration(seconds: 1)); | |
| final result = number.value * number.value; | |
| print("Squared ${number.value} to $result"); | |
| return result; |
This file contains hidden or 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
| import 'dart:async'; | |
| import 'dart:ffi'; | |
| import 'package:jni/jni.dart'; | |
| import 'package:shiur_23_app/android_utils.dart'; | |
| import 'package:shiur_23_app/player.interface.dart'; | |
| import 'package:solidart/solidart.dart'; | |
| import 'dart:core' as core show Future; | |
| import 'dart:core' hide Future; |
This file contains hidden or 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
| /// Shamelessly copied from flutter_signals | |
| import 'package:flutter_hooks/flutter_hooks.dart'; | |
| import 'package:solidart/solidart.dart'; | |
| /// Bind an existing signal to the hook widget | |
| T useExistingSignal<T extends ReadSignal>(T value) { | |
| final target = useMemoized(() => value, []); | |
| return use(_SignalHook('useExistingSignal', target)); | |
| } |
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| import 'package:flutter_solidart/flutter_solidart.dart'; | |
| class SignalInputController extends Signal<TextEditingValue> | |
| implements TextEditingController { | |
| late final TextEditingController _controller; | |
| late final Effect _effect; | |
| SignalInputController({String? text}) | |
| : super(TextEditingValue(text: text ?? "")) { |
This file contains hidden or 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
| import 'package:signals/signals.dart'; | |
| void main() { | |
| final counter = signal(0); | |
| effect(() => print(counter.value)); | |
| // Logs: 1 | |
| counter.value = 1; | |
| } |
This file contains hidden or 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
| import "package:riverpod/riverpod.dart"; | |
| void main() { | |
| // A `ProviderContainer` is the central storage for the state of all providers. | |
| final container = ProviderContainer(); | |
| // A `StateProvider` is used to expose a simple, mutable piece of state. | |
| // In this case, 'counter' holds an integer value, initialized to 0. | |
| final counter = StateProvider((ref) => 0); |
NewerOlder