how to use Riverpod with searchDelegate ? #2236
Replies: 1 comment
-
// inside SearchDelegate
@override
Widget buildResults(BuildContext context) {
// Create a RiverPod ConsumerWidget
return SearchResultView(query: query)
}
// Access state, api services etc.. e.g ref.read(appProvider.notifier).getLocations(query)
class SearchResultView extends ConsumerWidget {
...
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Aboidrees
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context:
I am using search delegate
showSearch(context: context, delegate: CustomeSearchDelegate);
to search Geo locations.I want to save former searches, so the user can research some locations. And this will be in the top of the suggestions (same as YouTube search).
CustomeSearchDelegate()
is a configuration object passed to a stateful widget (_SearchPage(delegate:delegate)
) that handles the search UI, which belongs to Flutter SDK.My Problem:
How to use Riverpod providers to show cached (local) or saved (remote server) suggestion?
Beta Was this translation helpful? Give feedback.
All reactions