site-www
site-www copied to clipboard
'A Tour of the Dart Libraries' page issue
Page URL: https://www.dartlang.org/guides/libraries/library-tour Page source: https://github.com/dart-lang/site-www/tree/master/src/_guides/libraries/library-tour.md
Description:
In the part "Using an asynchronous for loop", the sample uses argResults[recursive], while the variable at main is declared as arguments.
Also, a brief explanation or a link to this FileSystemEntity would be nice to understand all this methods.
We could really use a simpler example here. This one is rather hard to read, and it isn't tested.
About the existing code:
- I think arguments and argResults aren't supposed to be the same variable. (Check out the analyzed-but-not-tested source code at https://raw.githubusercontent.com/dart-lang/site-www/master/examples/misc/lib/library_tour/async/stream.dart.) The names don't make that clear at all, though.
- I wonder if the FileSystemEntity and Directory references are kind of leftovers from when the library tour included dart:io. The content has since been moved to https://www.dartlang.org/dart-vm/io-library-tour#listing-files-in-a-directory, although it still doesn't actually cover FileSystemEntity.
Interesting, I assumed they were the same variable because I couldn't see any other declaration, and it appeared to be used as the main arguments.
I agree, the example should be simpler and more readable.
I believe the primary issue here around the confusion of argResults and arguments was fixed with the migration to null safety(https://github.com/dart-lang/site-www/commit/937debbc7a9856583538166fd8adcecb7a989cec), but we could still consider moving away from an example not built around dart:io by just creating a simple, local method to illustrate the usage.