UI lags during heavy computation operation in Flutter even with async
Instead of this
TextButton( child: Text("Hash Password"), onPressed: () { hash("ThisIsTheMasterPassword").then((value) { print(value); });})
use this
TextButton( child: Text("Hash Password"), onPressed: () async{ hash("ThisIsTheMasterPassword").then((value) { print(value); }); })
or
TextButton( child: Text("Hash Password"), onPressed: ()async { var value=await hash("ThisIsTheMasterPassword");print(value); })
You can use isolate
to calculate of sth out of the main thread. https://www.youtube.com/watch?v=qrFTt1NZed8
compute(hash, "ThisIsTheMasterPassword");
Further reading https://flutter.dev/docs/cookbook/networking/background-parsing