title: Using an async constructor in Flutter
body: <p>I'd like to parse some stuff in a factory constructor, but one attribute will be given by a future. Unfortunately Flutter tells me that it isn't allowed to add a await/async to the factory constructor. Is there a nice way to fix this?</p>
  
  <p>Thank you very much for your help!</p>
  
  <p>This is my code:</p>
  
  <pre><code>class ClothDetails{
  
    final int clothId;
    final String title;
    final String image_path;
    bool pressed;
  
    ClothDetails(
        {this.clothId, this.title, this.image_path, this.pressed}
        );
  
    factory ClothDetails.fromJson(Map&lt;String, dynamic&gt; aJson) {
  
      return ClothDetails(
          clothId: int.parse(aJson['id']),
          title: aJson['title'],
          image_path: aJson['image_path'],
          pressed: isPressed(int.parse(aJson['id'])),
      );
    }
  
  Future&lt;bool&gt; isPressed(int curId) async {
      bool help;
      final DatabaseHelper dbHelper = DatabaseHelper.instance;
      List&lt;Map&lt;String, dynamic&gt;&gt; a = await dbHelper.queryRowsById(curId);
          if(a.isEmpty){
            help =false;
          }else{
            help= true;
          }
      return help;
    }
  }
  
  </code></pre>