Flutter @Error: Null safety features are disabled for this library Flutter @Error: Null safety features are disabled for this library ios ios

Flutter @Error: Null safety features are disabled for this library


I solved it by doing the following (for Visual Code on Windows 10):

in Command prompt (or whichever terminal you use with flutter in PATH):

flutter upgrade

And made sure that the version is at least 2.12 (which is the minimum required version for enabling null safety without using it as an experimental feature (I believe 🧐))

PS C:\> flutter upgradeFlutter is already up to date on channel stableFlutter 2.0.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 8962f6dc68 (2 days ago) • 2021-03-11 13:22:20 -0800Engine • revision 5d8bf811b3Tools • Dart 2.12.1

When that was confirmed, then I checked what my current sdk-version in the project was (in my case it was the following: sdk: ">=2.7.0 <3.0.0")

So I updated it to be the following instead: sdk: ">=2.12.0 <3.0.0".

So the environment should look as following:

environment:  sdk: ">=2.12.0 <3.0.0"


switch to dev/master channel

try to add sdk (that supports null safety) in pubspec.yaml file.In my case

environment:  sdk: ">=2.12.0-27.0.dev <2.12.0"

create analysis_options.yaml & add

analyzer:  enable-experiment:    - non-nullable

[optional]

if u r using vs code try to add

{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [    {        "name": "name",        "request": "launch",        "type": "dart",        "vmAdditionalArgs": [            "--enable-experiment=non-nullable",        ],    }]}


Here is the My solution in Android studio

  1. Add below line to your pubspec.yaml
analyzer:  enable-experiment:  - non-nullable
  1. Upgrade your SDK in pubspec.yaml
environment:  sdk: ">=2.13.0-68.0.dev <3.0.0"

This works for me...!!!!

Example

>     analyzer:>       enable-experiment:>       - non-nullable>     >     environment:   >       sdk: ">=2.13.0-68.0.dev <3.0.0"