Skip to content

Commit 54bef60

Browse files
committed
Add README.
1 parent a853afd commit 54bef60

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Template Method Pattern
2+
Iterator is a behavioral design pattern that lets you traverse elements of a collection without
3+
exposing its underlying representation (list, stack, tree, etc.).
4+
5+
Tutorial: [here](https://refactoring.guru/design-patterns/iterator).
6+
7+
## Diagram:
8+
![image](https://user-images.githubusercontent.com/8049534/183165928-7274e761-09e3-48ce-b9c1-41d552fa1f1a.png)
9+
10+
11+
### Client code:
12+
```dart
13+
void main() async {
14+
final GitHubRepo gitHubRepo = await GitHubLoader.get(
15+
userName: 'RefactoringGuru',
16+
repoName: 'design-patterns-dart',
17+
);
18+
19+
print(
20+
'Iterate last 10 commits.'
21+
'\n----------------------------',
22+
);
23+
24+
for (Commit commit in gitHubRepo.commitIterator()) {
25+
print(commit.message);
26+
}
27+
}
28+
```
29+
30+
### Output:
31+
```
32+
Iterate last 10 commits.
33+
----------------------------
34+
Merge pull request #74 from ilopX/fix-conceptual-command-pattern-folder-name Fix conceptual command pattern folder name
35+
Fix conceptual command pattern folder name.
36+
Merge pull request #73 from ilopX/add-conceptual-command-pattern Add conceptual command pattern
37+
Bump version 0.35.0.
38+
Add README.
39+
Impl conceptual command pattern.
40+
Merge pull request #72 from ilopX/add-singleton-pattern Add singleton pattern.
41+
Bump version 0.34.0.
42+
Add README.
43+
```
44+

0 commit comments

Comments
 (0)