title: how to transform a Future<dynamic> to string in dart:flutter
body: <p>I’m using some sqflite to do a query on a database, and extract a specific name of a table, for example: I have 3 names, Roberto, Ricardo and Andres, and I want to obtain only the name of Roberto, so this is what im doing:</p>
  
  <pre><code>loginLogic() async {
    var X = 'Roberto';
    final db = await database;
    List&lt;Map&gt; result = await db.rawQuery('SELECT * FROM Usuario WHERE username=?', [X]);
  </code></pre>
  
  <p>So now, I want to compare this result with another one to do an "if" function, just like this:</p>
  
  <pre><code>if(result==X){
    return 1;
  } else {
    return 0;
  }
  </code></pre>
  
  <p>But this is what flutter says: </p>
  
  <pre><code>List&lt;Map&lt;dynamic, dynamic&gt;&gt; result
  Equality operator '==' invocation with references of unrelated
  </code></pre>
  
  <p>And the Debug console:</p>
  
  <pre><code>type 'Future&lt;dynamic&gt;' is not a subtype of type 'int'
  </code></pre>
  
  <p>So I need a way to compare the value that results from the list of users with the string with the variable I declarated 'X'.</p>
  
  <p>Try using the reference of <a href="https://stackoverflow.com/questions/52068669/flutter-how-to-use-future-return-value-as-if-variable">this problem</a></p>
  
  <p>This is what I’ve tried: </p>
  
  <pre><code>loginLogicpar() async {
    var X = 'Giova';
    final db = await database;
    final result = await db.rawQuery('SELECT * FROM Usuario WHERE username=?', [X]);
    return result;
  }
  
  loginLogic() async {
    var X = 'Giova';
    final user = await loginLogicpar();
    if(user==X){
      return 1;
    }
    return 0;
  }
  </code></pre>
  
  <p>And returns the exact same result: type 'Future' is not a subtype of type 'int'</p>
  
  <p>Added <a href="https://pastebin.com/PWMA5pK7" rel="nofollow noreferrer">the code</a> so you can replicate it, just be sure you have sqflite on your depenencies.</p>