Last active
August 14, 2022 14:37
-
-
Save daiki1003/0e84c860a5dc15a4d22aab5786826fe9 to your computer and use it in GitHub Desktop.
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
class SomeWidget extends ConsumerWidget { | |
const SomeWidget({ | |
super.key, | |
}); | |
@override | |
Widget build(BuildContext context, WidgetRef ref) { | |
final musicId = ref.watch(musicIdProvider); | |
final volume = ref.watch(volumeProvider); | |
Future<void> playMusic() async { | |
final music = await searchMusic(); | |
// here can uses context, ref, musicId, and volume :) | |
} | |
Future<Music?> searchMusic() async { | |
// search | |
} | |
return TextButton( | |
onPressed: playMusic, | |
child: Text('sample'), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment