欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

[Dart]语法记录

程序员文章站 2022-05-02 13:12:07
...

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.

 

 

相关标签: dart