title: Dart json_serializable generic types
body: <p>I am trying to create a method that takes a generic JsonSerializable class and fetches it from an endpoint. The dart compiler is complaining that my generic type T does not have a method available. Where am I going wrong here because when I look at JsonConverter, I can see a method toJson that the generic type T must be implementing?</p>
  
  <pre><code>/// Get an object of type T from endpoint
  Future&lt;T&gt; getSingle&lt;T extends dtj.JsonConverter&lt;T, dynamic&gt;&gt;(String endpoint) async {
    print("Get from: $endpoint");
    final res = await http.get(env.apiUrl + endpoint);
  
    if (res.statusCode != 200) {
      throw Exception("Could not get from: $endpoint");
    }
    return T.fromJson(res.body);
  }
  </code></pre>