We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 038e3af commit 2ef4056Copy full SHA for 2ef4056
patterns/state/three_state/README.md
@@ -0,0 +1,22 @@
1
+# State Pattern
2
+State is a behavioral design pattern that lets an object alter its behavior when its internal state
3
+changes. It appears as if the object changed its class.
4
+
5
+Tutorial: [here](https://refactoring.guru/design-patterns/state).
6
7
+### Diagram:
8
+
9
10
+### Client code:
11
+```dart
12
+void main() {
13
+ final switcher = Switcher(
14
+ initState: One(),
15
+ );
16
17
+ switcher.call(); // call(1): One
18
+ switcher.call(); // call(2): Two
19
+ switcher.call(); // call(3): Three
20
+ switcher.call(); // call:(4) One
21
+}
22
+```
0 commit comments