[Dart]语法记录

1.Object & Dynamic

void log(Object object) {
  print(object.toString());
}

/// Returns a Boolean representation for [arg], which must
/// be a String or bool.
bool convertToBool(dynamic arg) {
  if (arg is bool) return arg;
  if (arg is String) return arg == 'true';
  throw ArgumentError('Cannot convert $arg to a bool.');
}

2.DO use Future<void> as the return type of asynchronous members that do not produce values.

相关推荐