How to make an asynchronous Dart call synchronous?

前端 未结 8 1553
心在旅途
心在旅途 2020-12-14 16:39

I\'m on the way to evaluate Dart for a German company by porting various Java programs to Dart and compare and analyze the results. In the browser Dart wins hands down. For

8条回答
  •  借酒劲吻你
    2020-12-14 17:12

    Dart is inherently async. Trying to avoid asynchronity won't work out. There are sync versions of some API calls for example in dart:io and in some situations it might seem simpler to use them instead but because there aren't sync versions for all methods/functions you can't avoid async entirely.

    With the recent introduction of the async/await feature programming async become much simpler and the code looks almost like sync code (but it isn't).

    If a call went async it stays async. As far as I know there is nothing you can do about it.

提交回复
热议问题