trevorwang / retrofit.dart

retrofit.dart is an dio client generator using source_gen and inspired by Chopper and Retrofit.
https://mings.in/retrofit.dart/
MIT License
1.06k stars 241 forks source link

Add null check to File type #664

Closed dickermoshe closed 4 months ago

dickermoshe commented 4 months ago

I encountered a bug that File is not checked for null before assigning a reading it. Fixes: https://github.com/trevorwang/retrofit.dart/issues/662

This will check for null:

final _data = body == null
        ? null
        : Stream.fromIterable(body.readAsBytesSync().map((i) => [i]));
dickermoshe commented 4 months ago

It turns out that this bug is on all nullable bodies. This will require a bigger fix