Skip to content

PageView applyViewportDimension throws Null check operator used on a null value #101007

Closed

Description

@stx

Found this very rare Crashlytics error in production on a Galaxy Note10+. I'm not sure of the trigger or a reproduction.

Looks like it's due to this:

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown Instance of 'ErrorDescription'.
       at _PagePosition.applyViewportDimension(page_view.dart:453)
       at RenderViewport.performLayout(viewport.dart:1456)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderCustomPaint.performLayout(custom_paint.dart:545)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at ChildLayoutHelper.layoutChild(layout_helper.dart:56)
       at RenderStack._computeSize(stack.dart:570)
       at RenderStack.performLayout(stack.dart:597)
       at RenderObject.layout(object.dart:1887)
       at _RenderLayoutBuilder.performLayout(layout_builder.dart:321)
       at RenderObject.layout(object.dart:1887)
       at MultiChildLayoutDelegate.layoutChild(custom_layout.dart:171)
       at _ScaffoldLayout.performLayout(scaffold.dart:1005)
       at MultiChildLayoutDelegate._callPerformLayout(custom_layout.dart:240)
       at RenderCustomMultiChildLayoutBox.performLayout(custom_layout.dart:403)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at _RenderCustomClip.performLayout(proxy_box.dart:1376)
       at RenderObject.layout(object.dart:1887)
       at ChildLayoutHelper.layoutChild(layout_helper.dart:56)
       at RenderStack._computeSize(stack.dart:570)
       at RenderStack.performLayout(stack.dart:597)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at ChildLayoutHelper.layoutChild(layout_helper.dart:56)
       at RenderStack._computeSize(stack.dart:570)
       at RenderStack.performLayout(stack.dart:597)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderOffstage.performLayout(proxy_box.dart:3430)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at _RenderTheatre.performLayout(overlay.dart:751)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at ChildLayoutHelper.layoutChild(layout_helper.dart:56)
       at RenderStack._computeSize(stack.dart:570)
       at RenderStack.performLayout(stack.dart:597)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderProxyBoxMixin.performLayout(proxy_box.dart:116)
       at RenderObject.layout(object.dart:1887)
       at RenderView.performLayout(view.dart:165)
       at RenderObject._layoutWithoutResize(object.dart:1731)
       at PipelineOwner.flushLayout(object.dart:887)
       at RendererBinding.drawFrame(binding.dart:497)
       at WidgetsBinding.drawFrame(binding.dart:883)
       at RendererBinding._handlePersistentFrameCallback(binding.dart:363)
       at SchedulerBinding._invokeFrameCallback(binding.dart:1144)
       at SchedulerBinding.handleDrawFrame(binding.dart:1081)
       at SchedulerBinding._handleDrawFrame(binding.dart:995)
Logs

[✓] Flutter (Channel stable, 2.10.1, on macOS 12.3 21E230 darwin-arm, locale en-US)
    • Flutter version 2.10.1 at /Users/james/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db747aa133 (7 weeks ago), 2022-02-09 13:57:35 -0600
    • Engine revision ab46186b24
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/james/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2021.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 11.0.11+0-b60-7772763)

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

[✓] Connected device (2 available)
    • Apollo (mobile) • da060dc78ac99566c39cb688206b34cb424a5ee1 • ios            • iOS 15.3.1 19D52
    • Chrome (web)    • chrome                                   • web-javascript • Google Chrome 99.0.4844.84
    ! Error: Apollo is busy: Preparing the watch for development via Apollo. Xcode will continue when Apollo is finished. (code -10)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!



Activity

  1. added
    in triagePresently being triaged by the triage team
    platform-androidAndroid applications specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    f: scrollingViewports, list views, slivers, etc.
    a: error messageError messages from the Flutter framework
    a: productionIssues experienced in live production apps
    a: null-safetySupport for Dart's null safety feature
    and removed
    in triagePresently being triaged by the triage team
    on Mar 30, 2022
  2. added
    c: crashStack traces logged to the console
    needs repro infoAutomated crash report whose cause isn't yet known
    P2Important issues not at the top of the work list
    on Mar 30, 2022
  3. SamTienz commented on Apr 25, 2022

    @SamTienz

    same issue here.
    I'm not sure of the trigger or a reproduction, too.

  4. krmao commented on May 4, 2022

    @krmao

    same issue here while flutter run --release

  5. bleroux commented on May 4, 2022

    @bleroux
    Contributor

    @krmao
    It would be very helpful if you can provide a minimal reproducible sample that shows the problem, thank you.

  6. krmao commented on May 5, 2022

    @krmao

    @bleroux I have fixed the problem after downgrad flutter version from 2.13.0-0.3.pre to 2.10.4.

    then all the command is run ok and without exception

      flutter run android -v
      flutter run android --release -v
    

    the version 2.13.0-0.3.pre is to fix android 12 emunitor about activity need "android:export=ture" property to install apk.

    my project can reproduction but the code is private, need more operation.

  7. 14 remaining items

  8. added
    a: releaseChallenges faced when attempting to productionize an app
    on May 19, 2022
  9. self-assigned this
    on May 20, 2022
  10. pPeterle commented on May 21, 2022

    @pPeterle

    I found the same problem when i test in profile mode

  11. jiangkang commented on May 25, 2022

    @jiangkang

    same issue when use TabBarView after upgrade 3.0.1

  12. oluwapaso commented on May 28, 2022

    @oluwapaso

    I have the same issue with version 3.0.1, Runs well in debug mode, but --release mode only runs well 90% of the time on the first launch, if I close the app and restart, that's when it shows the error and the app just hangs

    I/flutter (18940): Null check operator used on a null value
    I/flutter (18940): #0 _PagePosition.applyViewportDimension (package:flutter/src/widgets/page_view.dart:455)

  13. oluwapaso commented on May 28, 2022

    @oluwapaso

    I have the same issue with version 3.0.1, Runs well in debug mode, but --release mode only runs well 90% of the time on the first launch, if I close the app and restart, that's when it shows the error and the app just hangs

    I/flutter (18940): Null check operator used on a null value I/flutter (18940): #0 _PagePosition.applyViewportDimension (package:flutter/src/widgets/page_view.dart:455)

    Hi flutter team, apparently wrapping my runApp is some delay makes it go away, I think page dimension is returning null before proper app initialization that's why the applyViewportDimention is throwing an error. The code below appears to solve it now, I hope this helps someone for now.

    void main() {
    WidgetsFlutterBinding.ensureInitialized();

    Future.delayed(const Duration(seconds: 5), () {
    runApp(MyApp());
    });
    }

  14. bleroux commented on May 28, 2022

    @bleroux
    Contributor

    There is a pending PR to fix this : #104405.
    In the meanwhile, waiting a 5 seconds delay before calling runApp is a lot, 200ms should be enough.

  15. oluwapaso commented on May 28, 2022

    @oluwapaso

    There is a pending PR to fix this : #104405. In the meanwhile, waiting a 5 seconds delay before calling runApp is a lot, 200ms should be enough.

    Okay, understood, I end up using 1 second myself, at least till it's fixed

  16. TheCarpetMerchant commented on Jun 8, 2022

    @TheCarpetMerchant

    Will it be possible to cherrypick #104405 ? 99% of the time spent by my users is within a PageView, so that would be nice.

  17. github-actions commented on Jun 23, 2022

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  18. locked as resolved and limited conversation to collaborators on Jun 23, 2022
  19. moved this to Done (PR merged) in Nevercodeon Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: error messageError messages from the Flutter frameworka: null-safetySupport for Dart's null safety featurea: productionIssues experienced in live production appsa: releaseChallenges faced when attempting to productionize an appc: crashStack traces logged to the consolecp: reviewCherry-picks in the review queuef: scrollingViewports, list views, slivers, etc.found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specifically

Type

No type

Projects

  • Status
    Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions