Closed ImSeventy closed 1 year ago
This exception didn't occur using older version of flutter. It showed up after upgrading to the latest stable version
@ImSeventy In order to properly address the issue, we would need a complete but minimal reproducible code sample without third party package code implementation which throws the reported error. Currently, the code you shared seems to have third party implementation. So if you could narrow it down only to framework code which triggers the error, please provide that so we can make it actionable.
@ImSeventy In order to properly address the issue, we would need a complete but minimal reproducible code sample without third party package code implementation which throws the reported error. Currently, the code you shared seems to have third party implementation. So if you could narrow it down only to framework code which triggers the error, please provide that so we can make it actionable.
I have updated the issue providing the minimal code and a video of how it behaves
Thanks for the update and providing trimmed code, but it still is using flutter_screenutil
which is third party. Does it work without using the package ?
It's the one causing the issue as It calls MediaQuery during the build of the widget but _widget in framework.dart is being null during the build somehow and I think it's a flutter issue.
It was working in previous versions of flutter
@ImSeventy I suggest you to file the issue in package's dedicated repo to see what the package author has to say about it, accordingly we can take this issue forward.
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.
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.
Is there an existing issue for this?
Steps to reproduce
Expected results
As you can see in the provided video after returning back from the screen it should work like how it was working before I navigated to the screen.
During building the widget the screen_util library requires to access MediaQuery of the widget which in return tries to access the widget using the property in package:flutter/src/widgets/framework.dart
it uses null check operator and it seems that some how _widget variable is being null during the build process
Actual results
It shows the Null check operator used on a null value exception
Code sample
Code sample
Data Card Widget: ```dart class DataCard extends StatefulWidget { final String title; final MapScreenshots or Video
Screenshots / Video demonstration
[![BUG](https://youtu.be/67tVZ9EfKH4)](https://youtu.be/67tVZ9EfKH4) link: https://youtu.be/67tVZ9EfKH4Logs
Logs
```console [+1264 ms] ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following _TypeError was thrown building DataCard(dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#87140]], state: _DataCardState#15cc6): Null check operator used on a null value The relevant error-causing widget was: DataCard DataCard:file:///C:/Shop-Manager/shop_manager/lib/features/transactions/presentation/screens/transactions.dart:85:59 When the exception was thrown, this was the stack: #0 Element.widget (package:flutter/src/widgets/framework.dart:3361:31) #1 debugCheckHasMediaQuery.Flutter Doctor output
Doctor output
```console [✓] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Version 10.0.22621.1702], locale en-GB) [✓] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2) • Android SDK at C:\Android\sdk\ • Platform android-33, build-tools 33.0.0-rc2 • Java binary at: C:\Program Files\JetBrains\apps\AndroidStudio\ch-0\222.4459.24.2221.10121639\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694) • All Android licenses accepted. [✓] Chrome - develop for the web [✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.6.2) [✓] Android Studio (version 2021.1) [✓] IntelliJ IDEA Community Edition (version 2022.1) [✓] VS Code (version 1.79.1) [✓] Connected device (3 available) [✓] Network resources ```Minimal, Reproducible Code
Minimal, Reproducible Code
Code: ```dart import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; FutureA video showing how the minimal code behaves
link: https://www.youtube.com/watch?v=1Fa4bB3lOkg