Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in my stack track. No named parameter with the name ‘nullOk’ error in flutter in a flutter. So today Here I come with all possible solutions for this error.
We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.
How No named parameter with the name ‘nullOk’ error in flutter Error Occurs ?
When I run my app I get following error in my stacktrack.
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/neumorphic-0.4.0/lib/src/components/text_field.dart:953:32: Error: No named parameter with the name 'nullOk'.
MediaQuery.of(context, nullOk: true)?.navigationMode ??
^^^^^^
../../Developer/flutter/packages/flutter/lib/src/widgets/media_query.dart:818:25: Context: Found this candidate, but the arguments don't match.
static MediaQueryData of(BuildContext context) {
^^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/neumorphic-0.4.0/lib/src/neumorphic/theme.dart:390:52: Error: No named parameter with the name 'nullOk'.
_cupertinoOverrideTheme.resolveFrom(context, nullOk: nullOk),
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
How to Solve No named parameter with the name ‘nullOk’ error in flutter?
- How to Solve No named parameter with the name 'nullOk' error in flutter?
To Solve No named parameter with the name 'nullOk' error in a flutter Just check In your stack track error. Just look at which dependencies are giving nullOk error. Just update all those dependencies. Will Solve your error.
- No named parameter with the name 'nullOk' error
To Solve No named parameter with the name 'nullOk' error in a flutter Just check In your stack track error. Just look at which dependencies are giving nullOk error. Just update all those dependencies. Will Solve your error.
Solution 1 : Remove nullOk: true
Here Several nullOk
parameters have been removed as part of null safety post-migration. So that you can try to use .maybeOf(context)
instead of .of(context, nullOk: true);
OR You may have to update your dependencies to make it work.
Use
.maybeOf(context)
Instead of
.of(context, nullOk: true);
Solution 2 : Use nullOk false
Alter the media_query.dart
file, search for : static MediaQueryData of(BuildContext context)
function, then modify it to :
static MediaQueryData of(BuildContext context, { bool nullOk = false })
Solution 3 : update dependencies
In your stack track error. Just look at which dependencies are giving nullOk error. Just update all those dependencies. Will Solve your error.
Summery
So, It’s All About this error. I hope this tutorial helps you to Solve your error. Please Comment Below if You stucks anywhere with my code. And please comment below on which solution worked for you. Thank You.
Leave a Reply