Dart 2: Difference between Future and Future

后端 未结 1 684
旧巷少年郎
旧巷少年郎 2021-02-13 06:43

Having an asynchronous function that doesn\'t return a value, what\'s the ideal return type Future or Future?, or more specific

相关标签:
1条回答
  • 2021-02-13 07:42

    The type Null only allows the value null

    The type void allows values of any type, but communicates that the value shouldn't be used.

    It's not yet clear to me how tools support will treat void. There will probably linter rules that hint or warn at using void values.

    Null was used instead of void previously because void was only supported as return type of methods/functions.

    0 讨论(0)
提交回复
热议问题