Skip to content

ListWheelScrollView throws "Null check operator used on a null value" while loading images #125997

Closed

Description

@Z6P0

Is there an existing issue for this?

Steps to reproduce

This issue is similar to #60578

Run the following code.

Expected results

Should display a wheel of images.

Actual results

Throws exception "Null check operator used on a null value".
Images are displayed only after scrolling the wheel.

Code sample

Code sample
void main(List<String> args) {
  runApp(
    MaterialApp(
      home: Scaffold(
        body: ListWheelScrollView.useDelegate(
          itemExtent: 400,
          childDelegate: ListWheelChildLoopingListDelegate(
            children: List.generate(20, (i) => Image.network('https://via.placeholder.com/400')),
          ),
        ),
      ),
    ),
  );
}

Screenshots or Video

Screenshots / Video demonstration

Screenshot_1683137244

Logs

Logs
════════ Exception caught by image resource service ════════════════════════════
The following _CastError was thrown while resolving an image:
Null check operator used on a null value

When the exception was thrown, this was the stack
#0      ScrollPosition.minScrollExtent
#1      _FixedExtentScrollPosition.itemIndex
#2      _FixedExtentScrollPosition.copyWith
#3      ScrollPosition.recommendDeferredLoading
#4      Scrollable.recommendDeferredLoadingForContext
#5      ScrollAwareImageProvider.resolveStreamForKey
#6      ImageProvider.resolve.<anonymous closure>
#7      ImageProvider._createErrorHandlerAndKey.<anonymous closure>
#8      SynchronousFuture.then
#9      ImageProvider._createErrorHandlerAndKey
#10     ImageProvider.resolve
#11     _ImageState._resolveImage
#12     _ImageState.didChangeDependencies
#13     StatefulElement._firstBuild
#14     ComponentElement.mount
...     Normal element mounting (4 frames)
#18     Element.inflateWidget
#19     Element.updateChild
#20     ListWheelElement.updateChild
#21     ListWheelElement.createChild.<anonymous closure>
#22     BuildOwner.buildScope
#23     ListWheelElement.createChild
#24     RenderListWheelViewport._createChild.<anonymous closure>
#25     RenderObject.invokeLayoutCallback.<anonymous closure>
#26     PipelineOwner._enableMutationsToDirtySubtrees
#27     RenderObject.invokeLayoutCallback
#28     RenderListWheelViewport._createChild
#29     RenderListWheelViewport.performLayout
#30     RenderObject.layout
#31     RenderBox.layout
#32     RenderProxyBoxMixin.performLayout
#33     RenderObject.layout
#34     RenderBox.layout
#35     RenderProxyBoxMixin.performLayout
#36     RenderObject.layout
#37     RenderBox.layout
#38     RenderProxyBoxMixin.performLayout
#39     RenderObject.layout
#40     RenderBox.layout
#41     RenderProxyBoxMixin.performLayout
#42     RenderObject.layout
#43     RenderBox.layout
#44     RenderProxyBoxMixin.performLayout
#45     RenderObject.layout
#46     RenderBox.layout
#47     RenderProxyBoxMixin.performLayout
#48     RenderObject.layout
#49     RenderBox.layout
#50     RenderProxyBoxMixin.performLayout
#51     RenderObject.layout
#52     RenderBox.layout
#53     RenderProxyBoxMixin.performLayout
#54     RenderCustomPaint.performLayout
#55     RenderObject.layout
#56     RenderBox.layout
#57     RenderProxyBoxMixin.performLayout
#58     RenderObject.layout
#59     RenderBox.layout
#60     MultiChildLayoutDelegate.layoutChild
#61     _ScaffoldLayout.performLayout
#62     MultiChildLayoutDelegate._callPerformLayout
#63     RenderCustomMultiChildLayoutBox.performLayout
#64     RenderObject.layout
#65     RenderBox.layout
#66     RenderProxyBoxMixin.performLayout
#67     RenderObject.layout
#68     RenderBox.layout
#69     RenderProxyBoxMixin.performLayout
#70     _RenderCustomClip.performLayout
#71     RenderObject.layout
#72     RenderBox.layout
#73     RenderProxyBoxMixin.performLayout
#74     RenderObject.layout
#75     RenderBox.layout
#76     RenderProxyBoxMixin.performLayout
#77     RenderObject.layout
#78     RenderBox.layout
#79     RenderProxyBoxMixin.performLayout
#80     RenderObject.layout
#81     RenderBox.layout
#82     RenderProxyBoxMixin.performLayout
#83     RenderObject.layout
#84     RenderBox.layout
#85     RenderProxyBoxMixin.performLayout
#86     RenderObject.layout
#87     RenderBox.layout
#88     RenderProxyBoxMixin.performLayout
#89     RenderObject.layout
#90     RenderBox.layout
#91     RenderProxyBoxMixin.performLayout
#92     RenderObject.layout
#93     RenderBox.layout
#94     RenderProxyBoxMixin.performLayout
#95     RenderObject.layout
#96     RenderBox.layout
#97     RenderProxyBoxMixin.performLayout
#98     RenderObject.layout
#99     RenderBox.layout
#100    RenderProxyBoxMixin.performLayout
#101    RenderOffstage.performLayout
#102    RenderObject.layout
#103    RenderBox.layout
#104    RenderProxyBoxMixin.performLayout
#105    RenderObject.layout
#106    RenderBox.layout
#107    _RenderTheatre.performLayout
#108    RenderObject.layout
#109    RenderBox.layout
#110    RenderProxyBoxMixin.performLayout
#111    RenderObject.layout
#112    RenderBox.layout
#113    RenderProxyBoxMixin.performLayout
#114    RenderObject.layout
#115    RenderBox.layout
#116    RenderProxyBoxMixin.performLayout
#117    RenderObject.layout
#118    RenderBox.layout
#119    RenderProxyBoxMixin.performLayout
#120    RenderCustomPaint.performLayout
#121    RenderObject.layout
#122    RenderBox.layout
#123    RenderProxyBoxMixin.performLayout
#124    RenderObject.layout
#125    RenderBox.layout
#126    RenderProxyBoxMixin.performLayout
#127    RenderObject.layout
#128    RenderBox.layout
#129    RenderProxyBoxMixin.performLayout
#130    RenderObject.layout
#131    RenderBox.layout
#132    RenderProxyBoxMixin.performLayout
#133    RenderObject.layout
#134    RenderBox.layout
#135    RenderProxyBoxMixin.performLayout
#136    RenderObject.layout
#137    RenderBox.layout
#138    RenderProxyBoxMixin.performLayout
#139    RenderObject.layout
#140    RenderBox.layout
#141    RenderView.performLayout
#142    RenderObject._layoutWithoutResize
#143    PipelineOwner.flushLayout
#144    RendererBinding.drawFrame
#145    WidgetsBinding.drawFrame
#146    RendererBinding._handlePersistentFrameCallback
#147    SchedulerBinding._invokeFrameCallback
#148    SchedulerBinding.handleDrawFrame
#149    SchedulerBinding.scheduleWarmUpFrame.<anonymous closure>
#153    _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
(elided 3 frames from class _Timer and dart:async-patch)
Image provider: ScrollAwareImageProvider<Object>()
Image configuration: ImageConfiguration(bundle: PlatformAssetBundle#e4fea(), devicePixelRatio: 2.8, locale: en_US, textDirection: TextDirection.ltr, platform: android)
Image key: NetworkImage("https://via.placeholder.com/400", scale: 1.0)
════════════════════════════════════════════════════════════════════════════════

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.12, on Ubuntu 20.04.6 LTS 5.4.0-148-generic,
    locale fr_FR.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Community Edition (version 2021.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

Activity

  1. Sarraj-Sahar commented on May 3, 2023

    @Sarraj-Sahar

    Are you sure the issue isn't related to the network image link you're providing ? I changed the URL and it works for me.

    image

    Code sample
    void main(List<String> args) {
      runApp(
        MaterialApp(
          home: Scaffold(
            body: ListWheelScrollView.useDelegate(
              itemExtent: 400,
              childDelegate: ListWheelChildLoopingListDelegate(
                children: List.generate(
                 20,
                 //changed image url
                    (i) => Image.network('https://picsum.photos/200')),
              ),
            ),
          ),
        ),
      );
    }
  2. Z6P0 commented on May 3, 2023

    @Z6P0
    Author

    I tried with your image URL and many others and it's the same bug.
    I also tried with different Android emulator versions.

  3. darshankawar commented on May 4, 2023

    @darshankawar
    Member

    Thanks for the report. Using the code sample provided and with different urls, I am able to replicate the reported error using latest master and stable versions.
    I think it has to do with the type of childDelegate you are passing, in this case, is ListWheelChildLoopingListDelegate.

    I tried with another childDelegate as below with which too it throws the same error.

    return Scaffold(
          body: ListWheelScrollView.useDelegate(
            itemExtent: 400,
            physics: FixedExtentScrollPhysics(),
            childDelegate: ListWheelChildBuilderDelegate(
              builder: (context, index) => Image.network(
                'https://via.placeholder.com/400',
                height: 160,
                width: 160,
              ),
            ),
          ),
        );
    
    stable, master flutter doctor -v
    [!] Flutter (Channel stable, 3.7.12, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.7.12 on channel stable at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 4d9e56e694 (3 days ago), 2023-04-17 21:47:46 -0400
        • Engine revision 1a65d409c7
        • Dart version 2.19.6
        • DevTools version 2.20.1
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.11.0-1.0.pre.44, on macOS 12.2.1 21D62
        darwin-x64, locale en-GB)
        • Flutter version 3.11.0-1.0.pre.44 on channel master at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ebf3ea1755 (2 hours ago), 2023-05-03 23:25:08 -0400
        • Engine revision da45a21708
        • Dart version 3.1.0 (build 3.1.0-72.0.dev)
        • DevTools version 2.23.1
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
          
    [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Users/dhs/Library/Android/sdk
        ✗ cmdline-tools component is missing
          Run `path/to/sdkmanager --install "cmdline-tools;latest"`
          See https://developer.android.com/studio/command-line for more details.
        ✗ Android license status unknown.
          Run `flutter doctor --android-licenses` to accept the SDK licenses.
          See https://flutter.dev/docs/get-started/install/macos#android-setup for
          more details.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13C100
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 65.1.4
        • Dart plugin version 213.7228
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (3 available)
        • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
          • iOS 15.3.1 19D52
        • macOS (desktop)           • macos                                    •
          darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)              • chrome                                   •
          web-javascript • Google Chrome 109.0.5414.119
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
          
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
    
    
  4. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    c: crashStack traces logged to the console
    a: error messageError messages from the Flutter framework
    a: imagesLoading, displaying, rendering images
    and removed
    in triagePresently being triaged by the triage team
    on May 4, 2023
  5. TahaTesser commented on May 4, 2023

    @TahaTesser
    Contributor
  6. added
    P2Important issues not at the top of the work list
    on May 10, 2023
  7. hgandhi67 commented on Sep 7, 2023

    @hgandhi67

    Able to reproduce in 3.13.3 version as well.

  8. bpjhe commented on Jan 29, 2025

    @bpjhe

    Just wanted to chime in and say I stumbled upon the same problem (v3.27.1). Been trying to find a workaround but no luck. I managed to get the initial selected item to load an image by using a custom image provider, but the other ones on the screen will not load until they have been off-screen.

  9. added a commit that references this issue on Nov 6, 2026
    45c517a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: error messageError messages from the Flutter frameworka: imagesLoading, displaying, rendering imagesc: crashStack traces logged to the consolef: scrollingViewports, list views, slivers, etc.found in release: 3.11Found to occur in 3.11found in release: 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions