-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Closed
Labels
a: imagesLoading, displaying, rendering imagesLoading, displaying, rendering imagesa: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featureframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
Steps to Reproduce
The following code fails before throwing exception!
if (response.statusCode != HttpStatus.ok) {
// The network may be only temporarily unavailable, or the file will be
// added on the server later. Avoid having future calls to resolve
// fail to check the network again.
await response.drain<List<int>>();
throw image_provider.NetworkImageLoadException(statusCode: response.statusCode, uri: resolved);
}
Expected results:
This should be invoked:
throw image_provider.NetworkImageLoadException(statusCode: response.statusCode, uri: resolved);
Actual results:
I/flutter (18983): The following _CastError was thrown resolving an image codec:
I/flutter (18983): type 'Null' is not a subtype of type 'List<int>' in type cast
I/flutter (18983):
I/flutter (18983): When the exception was thrown, this was the stack:
I/flutter (18983): #1 NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:99:24)
I/flutter (18983): <asynchronous suspension>
Logs
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale en-FI)
• Flutter version 2.2.3 at /Users/egaga/dev/flutter
• Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
PerLycke and NicolaVerbeeck
Metadata
Metadata
Assignees
Labels
a: imagesLoading, displaying, rendering imagesLoading, displaying, rendering imagesa: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featureframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.