Skip to content

[web][regression] Image.network doesn't render in debug mode & throws Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'  #69571

@TahaTesser

Description

@TahaTesser

Steps to Reproduce

  1. Create a new project flutter create master_flutter on the latest master channel
  2. Use Image.network in the web app
code sample
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      theme: ThemeData.dark(),
      home: Home(),
    );
  }
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Material App Bar'),
      ),
      body: Center(
        child: Image.network('https://i.imgur.com/QCNbOAo.png'),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {},
      ),
    );
  }
}
  1. Execute flutter run -d chrome

(no issue with flutter run --release chrome)

Expected Results Actual Results
Screenshot 2020-11-02 at 5 30 48 PM Screenshot 2020-11-02 at 5 25 42 PM

Additional context:

  1. Image.network renders in release mode
  2. Doesn't reproduce on the dev channel
  3. The issue is reproducible on the master channels since Sunday
  4. Reproduce on the web on mac and windows too, haven't tested on Linux
logs
Running "flutter pub get" in master_flutter...
Launching lib/main.dart on Chrome in debug mode...
 lib/main.dart
Debug service listening on ws://127.0.0.1:61945/nvvdZzPpjGM=/ws
Connecting to VM Service at ws://127.0.0.1:61945/nvvdZzPpjGM=/ws

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
�[38;5;244mThe following TypeErrorImpl was thrown while resolving an image:�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'

�[38;5;244mWhen the exception was thrown, this was the stack�[39;49m
�[38;5;248mdart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 216:49      throw_�[39;49m
�[38;5;248mdart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 64:3        castError�[39;49m
�[38;5;248mdart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 442:10  cast�[39;49m
�[38;5;248mdart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart 571:14     as_C�[39;49m
�[38;5;248mpackages/flutter/src/painting/_network_image_web.dart 95:8                        [_loadAsync]�[39;49m
�[38;5;244m...�[39;49m
�[38;5;244mImage provider: ScrollAwareImageProvider<Object>()�[39;49m
�[38;5;244mImage configuration: ImageConfiguration(bundle: PlatformAssetBundle#44d7e(), devicePixelRatio: 2.0, locale: en_US, textDirection: TextDirection.ltr, platform: macOS)�[39;49m
�[38;5;244mImage key: NetworkImage("https://i.imgur.com/QCNbOAo.png", scale: 1)�[39;49m
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m

�[38;5;248m════════ Exception caught by image resource service ════════════════════════════�[39;49m
Expected a value of type 'Future<Codec>', but got one of type '_Future<Codec?>'
�[38;5;248m════════════════════════════════════════════════════════════════════════════════�[39;49m
flutter doctor -v
[✓] Flutter (Channel master, 1.24.0-7.0.pre.51, on Mac OS X 10.15.7 19H2
    darwin-x64, locale en-GB)
    • Flutter version 1.24.0-7.0.pre.51 at /Users/tahatesser/Code/flutter_master
    • Framework revision 734d2a22fe (2 hours ago), 2020-11-02 15:23:02 +0530
    • Engine revision 3460519398
    • Dart version 2.12.0 (build 2.12.0-3.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/tahatesser/Code/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/tahatesser/Code/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.0.rc.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.50.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (4 available)
    • Taha’s iPad (mobile) • 00008020-000255113EE8402E • ios            • iOS
      14.1
    • macOS (desktop)      • macos                     • darwin-x64     • Mac OS
      X 10.15.7 19H2 darwin-x64
    • Web Server (web)     • web-server                • web-javascript •
      Flutter Tools
    • Chrome (web)         • chrome                    • web-javascript • Google
      Chrome 86.0.4240.111

• No issues found!

Metadata

Metadata

Assignees

Labels

a: imagesLoading, displaying, rendering imagesa: null-safetySupport for Dart's null safety featurec: crashStack traces logged to the consolec: regressionIt was better in the past than it is nowfound in release: 1.24Found to occur in 1.24frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallywaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions