Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null

Hello readers, Today In this article I am going to show you how to Solve – Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null in Flutter. So here I will explain all the possible solutions.

Without wasting your time, Let’s start This Article to Solve This Error.

How Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null Occurs?

This is a common error in Flutter. When I am trying to use the firebase_messaging package in my flutter project, but I got the following error. It looks as like below:

Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null

So here are all the possible solutions that I tried to fix this error.

How To Solve Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null?

  • How To Solve Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null?

To Fix Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null Error just Use the lower version of firebase_auth. You have to upgrade the dart version or just use the lower version of firebase_auth. You can use the below command: firebase_auth: 2.0.0.Now, I hope your error will be gone.

  • Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null

To Fix Error: A non-null value must be returned since the return type ‘Never’ doesn’t allow null Error just use Change to ext.kotlin_version. First of all, upgrade to the new flutter version. we have to upgrader things also in build.gradleOpen Command Prompt and run this command. flutter upgrade Now just Go to android/build.gradle and just change to ext.kotlin_version = ‘1.6.10’ And after it Go to android/app/build.gradle and change minSdkVersion to 19 and just add multiDexEnabled true. Now, I hope your error will be gone.

Solution 1 : Use the lower version of firebase_auth

You have to upgrade the dart version or just use the lower version of firebase_auth.

  firebase_auth: 2.0.0

Solution 2 : Change to ext.kotlin_version

First of all, upgrade to the new flutter version. Open Command Prompt and run this command.

flutter upgrade

Now just Go to android/build.gradle and just change to ext.kotlin_version = ‘1.6.10’

And after it Go to android/app/build.gradle and change minSdkVersion to 19 and just add multiDexEnabled true.

Now, Your error will be solved.

Conclusion

In this article, we have discussed what causes the error and we have discussed ways to fix the error.

we hope this article has been informative. Thank you for reading. Kindly comment and let us know if you found it helpful.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Categories