-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
package:argstype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
This is a runtime failure in Dart2:
void readListOfNames(ArgResults results) {
// "List<dynamic> is not a List<String>"
List<String> names = results['names'];
}... but patterns like this are really common.
I'd like to see a series of helper methods to make it easier to get common types and collections out of ArgResults, even if all they do behind the scenes is a combination of as and collection casts. Ideas:
Primitives
-
bool readBool(String name) -
double readDouble(String name) -
int readInt(String name) -
String readString(String name)
Collections
-
List<String> readStringList(String name)
Thoughts?
/cc @nex3 @natebosch
kevmoo, jonahwilliams, thosakwe, enyo, srawlins and 2 more
Metadata
Metadata
Assignees
Labels
package:argstype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug