Flutter Design Patterns: 6 — State
An overview of the State design pattern and its implementation in Dart and Flutter
Previously in the series, I have analysed one of the most practical design patterns you can use in day-to-day coding — Strategy. In this article, I will analyse and implement a pattern, which has a similar structure to Strategy but is used for a different purpose — the State design pattern.
Update 2022–09–15: I moved this blog to my personal website. For a better reading experience, up to date articles, interactive code examples and some extra content FOR FREE, check kazlauskas.dev.
Table of Contents
- What is the State design pattern?
- Analysis
- Implementation
- Other articles in this series
- Your contribution
What is the State design pattern?
The State is a behavioural design pattern, which intention in the GoF book is described like this:
Allow an object to alter its behaviour when its internal state changes. The object will appear to change its class.