Skip to content

Add iterator pattern. #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2022
Merged

Add iterator pattern. #75

merged 3 commits into from
Aug 5, 2022

Conversation

ilopX
Copy link
Collaborator

@ilopX ilopX commented Aug 5, 2022

Template Method Pattern

Iterator is a behavioral design pattern that lets you traverse elements of a collection without
exposing its underlying representation (list, stack, tree, etc.).

Tutorial: here.

Diagram:

image

Client code:

void main() async {
  final GitHubRepo gitHubRepo = await GitHubLoader.get(
    userName: 'RefactoringGuru',
    repoName: 'design-patterns-dart',
  );

  print(
    'Iterate last 10 commits.'
        '\n----------------------------',
  );

  for (Commit commit in gitHubRepo.commitIterator()) {
    print(commit.message);
  }
}

Output:

Iterate last 10 commits.
----------------------------
Merge pull request #74 from ilopX/fix-conceptual-command-pattern-folder-name Fix conceptual command pattern folder name
Fix conceptual command pattern folder name.
Merge pull request #73 from ilopX/add-conceptual-command-pattern Add conceptual command pattern
Bump version 0.35.0.
Add README.
Impl conceptual command pattern.
Merge pull request #72 from ilopX/add-singleton-pattern Add singleton pattern.
Bump version 0.34.0.
Add README.

@ilopX ilopX merged commit 4983c26 into RefactoringGuru:main Aug 5, 2022
@ilopX ilopX deleted the add-iterator-pattern branch August 5, 2022 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant