Skip to content

Instantly share code, notes, and snippets.

Last active August 14, 2022 14:37
What would you like to do?
class SomeWidget extends ConsumerWidget {
const SomeWidget({
Widget build(BuildContext context, WidgetRef ref) {
final musicId =;
final volume =;
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