Advertisement
Guest User

Untitled

a guest
Aug 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.63 KB | None | 0 0
  1. FutureBuilder(
  2.               future: doesNameAlreadyExist(Controller.text),
  3.               builder: (context, AsyncSnapshot<bool> result) {
  4.                 if (!result.hasData)
  5.                   return Container(); // future still needs to be finished (loading)
  6.                 if (result
  7.                     .data) { // result.data is the returned bool from doesNameAlreadyExists
  8.                   return Text("Your ID exists",style: TextStyle(color: Colors.green),);
  9.                 }
  10.                 else
  11.                   return Text("Your ID does not exist",style: new TextStyle(color: Colors.red),);
  12.               },
  13.             ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement