0

String longMehtod() async{
    await longProcess()
    return ok;
}

Future<String> a = longMehtod()
//add some code to block the process to wait Future complete and I can get the value of a 

Can I block the process and make sure the value must be print without use await/async?

or is there any method like blockingget in Rxjava?

ChandlerSong
  • 387
  • 1
  • 14
  • I have add some code. I hope it make my question more clear – ChandlerSong Jun 30 '19 at 12:25
  • You can wait by this code `Future a = await longMehtod();` – mezoni Jun 30 '19 at 14:46
  • @mezoni, `await` does not return a `Future`, it's `String a = await longMethod();` – Rui Pires Jun 30 '19 at 16:22
  • @RuiPires, Oh yes, this is my oversight. This is because I use `var` or `final`, instead of constantly worrying about what type of data in the total will be obtained in the calculation process. I do not like to write unnecessary code, which, moreover, is a bad programming style. I mean a direct indication of the type of `lvalue` obtained from `rvalue`. – mezoni Jun 30 '19 at 17:41

0 Answers0