Flutter Riverpod Future Provider – Example

Asynchronous operations are in almost every application that works with a backend. Whether it is GraphQL, Rest, or anything else, you have the same pattern. You start the request, and you wait till the request is finished before you show the data. In Flutter, Riverpod provides us with the FutureProvider. With the FutureProvider, the UI can deal with this synchronously. The FutureProvider will let the Widgets know when the data is ready or when the call failed. Setup the Project Before we can…

Read More

Flutter Riverpod Testing – Example

Testing your Widget is important during Application Development. When it grows more complex, it becomes more work to test everything manually. Having tests for your widgets makes sure that the Widgets behave as we expect them to. This saves time when developing new features. In the last blog post, we already showed how to do this with Flutter Hooks. In this blog post, we are testing our Flutter Riverpod example. Setup the project Before we can start with coding, we…

Read More

Flutter Hooks – Testing Your Widgets

Testing your Widget is important during Application Development. When it grows more complex, it becomes more work to test everything manually. Having tests for your widgets makes sure that the Widgets behave as we expect them to. This saves time when developing new features. This way, you do not have to test all other features again. In this blog post, we will describe how to create tests for your Widgets that contain Flutter Hooks. Setup the project Before we can…

Read More

Riverpod State Management Example – Tic Tac Toe

We are going to show another example of Riverpod. This time we will create Tic Tac Toe. As shown earlier, we can easily create Tic Tac Toe with animation in Flutter. However, the state management was all over the place. In this blog post, we will show a better way to manage the state with Riverpod. Secondly, we are going to show another example of Flutter Freezed. Immutables can greatly help with reducing errors in your code, and it works…

Read More

Flutter Freezed – Working with Immutable’s

There are times when immutable objects can make your life a lot simpler. Freezed is here to simplify working with immutable’s in Flutter. As they say: yet another code generator for unions They promise simple syntax without compromising the number of features. Before we start let’s take a quick look at what exactly is an immutable object. An object whose state cannot be changed after construction But why would you want to work with immutable’s? This is a question…

Read More

Animations on Value Changed with Flutter & Riverpod

With Riverpod, we can extract the state management from the Widgets. However, this also means that the Widget has no control over the value changes. When we want to start an animation when the value changes, we have to look for updates to handle the animation in the Widget. In this blog post, we will show you three different animations based on value changes. After writing about animations in Flutter and Riverpod it was about time to combine both! Setting…

Read More

Flutter Riverpod Example – Category Selection

In the latest blog posts, I wrote about Flutter Hooks and the Provider to simplify state management in Flutter. We described how to simplify the modal dialog selector of categories with Flutter Hooks and with the Provider. However, there is also an option to combine both. Riverpod is a Provider but different! Riverpod has multiple benefits, such as supporting multiple providers of the same type, combining asynchronous providers, and adding providers from anywhere. Furthermore, it provides a way to combine…

Read More

How to Process GraphQL Subscriptions in Flutter

In this blog post, we are going to explain how to work with GraphQL Subscriptions in Flutter. We are going to create a simple counter app that will increase the number by one each time we press a button. We will increase the button with an increment mutation to prevent race conditions between different users. Thus the app will not increment, but the GraphQL endpoint will. After the mutation, we will move on to the subscription to listen to changes.…

Read More

Flutter Drag and Drop Example

For a little game, I needed to drag and drop items. I have never seen it as easy as in Flutter. So in this blog post, we will describe how to implement the drag and drop of checkers on checkerboard in Flutter. The goal is to draw a checkerboard, add checkers, and make it possible for the checkers to be dragged around. For state management, we will use the provider. If this is completely new to you, the previous blog…

Read More

Flutter Provider Example Category Selector

In the latest blog posts, I have been writing about Flutter Hooks to simplify state management in Flutter. We described how to simplify the modal dialog selector of categories with Flutter Hooks. However, Flutter Hooks is not the only solution. Another option is to use a provider which is used in the simple app state management page of Flutter. We will rewrite the modal category dialog selector as an example, except that this time we will use the provider. A…

Read More