Skip to content

Commit

Permalink
Create nested-generators-in-dart.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
vandadnp committed Jul 26, 2022
1 parent 6183099 commit 9c184c7
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 🐦 Twitter https://twitter.com/vandadnp
// πŸ”΅ LinkedIn https://linkedin.com/in/vandadnp
// πŸŽ₯ YouTube https://youtube.com/c/vandadnp
// πŸ’™ Free Flutter Course https://linktr.ee/vandadnp
// πŸ“¦ 11+ Hours Bloc Course https://youtu.be/Mn254cnduOY
// πŸ”Ά 7+ Hours MobX Course https://youtu.be/7Od55PBxYkI
// πŸ¦„ 8+ Hours RxSwift Coursde https://youtu.be/xBFWMYmm9ro
// 🀝 Want to support my work? https://buymeacoffee.com/vandad

import 'dart:developer' as devtools show log;

extension Log on Object {
void log() => devtools.log(toString());
}

Iterable<String> maleNames() sync* {
yield 'John';
yield 'Peter';
yield 'Robert';
}

Iterable<String> femaleNames() sync* {
yield 'Mary';
yield 'Patricia';
yield 'Linda';
}

Iterable<String> allNames() sync* {
yield* maleNames();
yield* femaleNames();
}

void testIt() {
// (John, Peter, Robert, Mary, Patricia, Linda)
allNames().log();
}

0 comments on commit 9c184c7

Please sign in to comment.