Riverpod — Samples — II

ryandam
Jan 6, 2022

--

Overview

I was trying to see how to use two State providers in Riverpod and one of them depends on the other. Two approaches are given here.

  • The example fetches X number of jokes from an API, where X is one state and is incremented whenever floating action button is pressed.
  • The other state is the jokes.

Whenever the counter changes, those many number of jokes are fetched from the API and they become the new state. A ListView is rendered using the latest list of jokes.

Sample #1

Sample #2

#3 Try on Dartpad

#4 More Articles

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response