Flutter – How to deal with global variables

The last blog post shows you how to use the event bus to publish and subscribe to events. In this example, there is a global variable for the event bus to simplify the example. In this blog post, I will show you how to deal with the global variable. First, I am going to show you how to pass down the information with an Inherited Widget. Secondly, I am going to show you how to do this with the Provider…

Read More

Event-Based Flutter Example

Recently I encountered the event_bus package on pub.dev. The Event Bus package allows you to easily implement the publisher-subscriber pattern in Flutter. With the publisher-subscriber pattern, it is possible to decouple the publisher and the subscriber. I am going to show how you could use this to create the counter example and a simple to-do list. However, be cautious with this pattern. Most of the time you are better off with Bloc or Riverpod for state management. Setup the project…

Read More

Cat and Mice – Part 4: Implementing the AI

In this weekly blog series about Cat and Mice, I will discuss the whole process, from design to implementation, from publishing to artificial intelligence. Cat and Mice is a game that is played on a checkers board. One player plays the cat and has only one piece. The piece of this player starts at one side of the checker’s board. On the other side are four pieces of the mice. The goal for the cat is to reach the other…

Read More

Cat and Mice – Part 3: Implementing the Game

In this weekly blog series about Cat and Mice, I will discuss the whole process, from design to implementation, from publishing to artificial intelligence. Cat and Mice is a game that is played on a checkers board. One player plays the cat and has only one piece. The piece of this player starts at one side of the checker’s board. On the other side are four pieces of the mice. The goal for the cat is to reach the other…

Read More

Cat and Mice – Part 2: Architecture

In this weekly blog series about Cat and Mice, I will discuss the whole process, from design to implementation, from publishing to artificial intelligence. Cat and Mice is a game that is played on a checkers board. One player plays the cat and has only one piece. The piece of this player starts at one side of the checker’s board. On the other side are four pieces of the mice. The goal for the cat is to reach the other…

Read More

Cat and Mice – Part 1: CI/CD

In this weekly blog series about Cat and Mice, I will discuss the whole process, from design to implementation, from publishing to artificial intelligence. Cat and Mice is a game that is played on a checkers board. One player plays the cat and has only one piece. The piece of this player starts at one side of the checker’s board. On the other side are four pieces of the mice. The goal for the cat is to reach the other…

Read More

Cat and Mice – Part 0: The Goal

In this weekly blog series about Cat and Mice, I will discuss the whole process, from design to implementation, from publishing to artificial intelligence. Cat and Mice is a game that is played on a checkers board. One player plays the cat and has only one piece. The piece of this player is placed at one side of the checker’s board. On the other side are four pieces of the mice. The goal for the cat is to reach the…

Read More

Flutter Drag and Drop – State Management

We have showed how to implement a simple drag and drop application in Flutter. However the state management in the blog post was very simplistic and probably only useful for the most basic use cases. Of course, you can still learn about drag and drop and integrate it with your own state management solution. In this blog post, we will show how to integrate the drag and drop with the Riverpod state management solution. However, there are more excellent state…

Read More

Flutter GetX Example – Category Selection

In the latest blog posts, I wrote about Flutter Hooks, Provider, and Riverpod to simplify state management in Flutter. We described how to streamline an interactive category selection application. The user can select categories in one Widget and access those categories in another Widget. With the state management solutions, this is a lot easier to reason about, write and maintain the code. There are multiple solutions, such as GetX and Riverpod, which have different approaches. In this blog post, we…

Read More

Creating a Cat Voting App with Flutter

Recently, I discovered The Cat API. This API returns an image of a cat on which we can vote. Their front page shows a great example. As an owner of two adorable cats, I immediately knew that I had to create a simple app for this. Luckily with Flutter, this is a pretty simple thing to build! So what are we going to develop? First, we will display an image of a cat. Then, the user can swipe it to…

Read More