Home > other >  What is the type for Future.delayed(const Duration(seconds: 1))?
What is the type for Future.delayed(const Duration(seconds: 1))?

Time:07-08

I added an "always_specify_type" to my lint check, it is asking me to enter the type for:

await Future<???>.delayed(const Duration(seconds: 1)); What should this type be and why? Should it be Void or Null or something else?

CodePudding user response:

You should use void since you have no intention of actually using the value returned from the Future. By doing so, you will get a compile error if you are ending up trying to use the returned value by accident.

  •  Tags:  
  • dart
  • Related