title: How to handle 204 response in Retrofit using Dart?
body: <p>I'm using <a href="https://pub.dev/packages/retrofit" rel="nofollow noreferrer">retrofit: ^3.0.1+1</a> and <a href="https://pub.dev/packages/retrofit_generator" rel="nofollow noreferrer">retrofit_generator: ^4.0.3+1</a> with Flutter and Dart.</p>
  <p>I have a Retrofit method as such:</p>
  <pre><code>  @GET(ApiDashboard.urlFaults)
    Future&lt;HttpResponse&lt;List&lt;FaultModel&gt;&gt;&gt; fetchFaults({
      @Query(ApiDashboard.queryKey) required String key,
      @Query(ApiDashboard.queryFaultStartTime) required String startTime,
      @Query(ApiDashboard.queryFaultEndTime) required String endTime,
    });
  </code></pre>
  <p>This call returns an HTTP 204 No Content response, which causes a crash in Retrofit:</p>
  <blockquote>
  <p>DioError [<code>DioErrorType.other</code>]: type '<code>String</code>' is not a subtype of type
  '<code>List&lt;dynamic&gt;?</code>' in type cast</p>
  </blockquote>