How to null-check a simple Function in Dart?

后端 未结 0 1413
感情败类
感情败类 2020-12-20 15:56
void main() {
  Car myCar = Car(drive: slowDrive);
  myCar.drive();
}

class Car {
  Car({this.drive});
  Function? drive;
}

void slowDrive() {
  print(\'Driving sl         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题