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 c5b867d commit e2a9d3eCopy full SHA for e2a9d3e
patterns/singleton/conceptual/README.md
@@ -0,0 +1,28 @@
1
+# Singleton Pattern
2
+Singleton is a creational design pattern that lets you ensure that a class has only one instance,
3
+while providing a global access point to this instance.
4
+
5
+Tutorial: [here](https://refactoring.guru/design-patterns/singleton).
6
7
+### Diagram:
8
+
9
10
+### Client code:
11
+```dart
12
+void main() {
13
+ // dart style
14
+ Singleton().doSome();
15
16
17
+ // standard style
18
+ Singleton.instance.doSome();
19
+}
20
+```
21
22
+### Output:
23
24
+Create singleton once.
25
+doSome()
26
27
28
0 commit comments