title: How to compare user input and the record in sqflite
body: <p>In sqflite database, I have a table called user. The user consists of username a, b, c. </p>
  
  <p>When user enter the input var a, the system will compare with the username in table user. If user input equal to username in table user, system will print the error message, else the system will print success. </p>
  
  <p>I try to use the future builder, but it didn´t work. How can I do the validation in Test.dart? </p>
  
  <p>Thank you.</p>
  
  <p>This is my code:</p>
  
  <p><strong><em>SqliteHelper.dart</em></strong></p>
  
  <pre><code> Future getDat(UserAccount userAccount) async {
  var dbClient = await db;
  name = userAccount.username;
  List&lt;Map&gt; result = await dbClient.query("UserAccount",
      where: "username =?", whereArgs: [userAccount.username]);
  if (result.length == 1) {
   return  name;
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong><em>Test.dart</em></strong></p>
  
  <pre><code>_saveData() async {
  
  
    var db = UserAccountHelper();
    var mynote = UserAccount(cTitle.text);
    await db.getDat(mynote);
        FutureBuilder(
        future: db.getDat(mynote),
        builder: (context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);
          var data = snapshot.data;
          if (snapshot.hasData) print("test 3");
          if(snapshot.data.toString() == cTitle.text.toString()) 
          {print("success")} 
          else{print("error")};
        });
  </code></pre>
  
  <p>}</p>