title: Flutter create sqlite database helper to return only 1 String or any other single object type
body: <p>Using sqlite in Android (java base) are quite simple. I can retrieve whether list of data, or just single data in such way using my custom database helper.</p>
  
  <p><strong>i.e</strong>:</p>
  
  <pre><code>    public String getLastNetPrintUrl() {
      String lastPrintUrl;
      String lastId = "SELECT * FROM " + TABLE_NET_PRINT + " WHERE " + COL_NETPRINT_ID +
              " = (SELECT MAX(" + COL_NETPRINT_ID + ") FROM " + TABLE_NET_PRINT + ")";
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor cursor = db.rawQuery(lastId, null);
      if(cursor.moveToFirst()) {
          lastPrintUrl = cursor.getString(4);
      } else {
          lastPrintUrl = "";
      }
      db.close();
      return lastPrintUrl;
  }
  </code></pre>
  
  <p>In above piece of code, I simply want to get the last recorded URL. Then in the activity, I can just call </p>
  
  <pre><code>String netPrintUrl = dbhelper.getLastNetPrintUrl();
  </code></pre>
  
  <p>How can I achieve the same goal using sqflite in Flutter?</p>
  
  <p>What I've done so far, </p>
  
  <pre><code>  Future&lt;String&gt; getLastUrl() async {
  var dbClient = await db;
  String lastUrlQuery = 'SELECT * FROM device WHERE id = (SELECT MAX( id ) FROM device)';
  var dbQuery = await dbClient.rawQuery(lastUrlQuery);
  if (dbQuery.length &gt; 0) {
    String lastUrl = dbQuery.first.values.toString();
    return lastUrl;
  } else {
    return '192.168.11.17:7700';
  }
  </code></pre>
  
  <p>}</p>
  
  <p>But whenever I tried to call that method, just the same way, like </p>
  
  <pre><code>String lastUrl = dbhelper.getLastUrl;
  </code></pre>
  
  <p>Value type of Future can't be assigned to variable of type 'String';</p>
  
  <p>I'm still pretty new to Flutter, and couldn't find any reference about my intention above. Any hints are appreciated.</p>
  
  <p><strong>*edit:</strong></p>
  
  <p>That 'Device' table only contain 2 column, which is integer unique id, and  url (as text).</p>
  
  <p><strong>edit:</strong> <em>final part of code</em></p>
  
  <pre><code>final _formKey = new GlobalKey&lt;FormState&gt;();
  final _urlController = new TextEditingController();
  
  DatabaseHelper dbhelper = DatabaseHelper();
  String atiDeviceUrl;
  
  Future getUrl() async{
    atiDeviceUrl = await dbhelper.getLastUrl();
    _urlController.text = atiDeviceUrl;
    print('atiDeviceUrl: $atiDeviceUrl');
  }
  
  @override
  void initState() {
    getUrl();
    super.initState();
  }
  </code></pre>