Skip to content

Instantly share code, notes, and snippets.

@FlutterWiz
Created June 18, 2022 12:34
Show Gist options
  • Save FlutterWiz/30e5bbdc0f3ba3d210289aa92e777c2f to your computer and use it in GitHub Desktop.
Save FlutterWiz/30e5bbdc0f3ba3d210289aa92e777c2f to your computer and use it in GitHub Desktop.
Consumer(
builder: (context, ref, child) {
return IconButton(
onPressed: () {
if (textfieldController.text.isEmpty) {
ref.refresh(searchProvider);
} else {
ref.refresh(searchProvider);
ref.read(searchProvider.notifier).mapEventsToState(
SearchedTextChanged(
text: textfieldController.text,
),
);
}
},
icon: const Icon(
Icons.search,
color: whiteColor,
),
);
},
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment