4

The imports I am using:

import 'package:flutter/material.dart';
import 'package:splashscreen/splashscreen.dart';
import 'package:imagetotext/homePage.dart';

However, the linter is giving me the following warning:

The library 'package:splashscreen/splashscreen.dart'' is legacy, and should not be imported into a null safe library. Try migrating the imported library. import_of_legacy_library_into_null_safe

The dependencies I am using:

  cupertino_icons: ^1.0.3
  splashscreen: ^1.3.3

error image

problem

Alex Meuer
  • 1,621
  • 3
  • 26
  • 37
078_Aaryan
  • 49
  • 1
  • 2
  • 1
    This isn't a problem in your code, it's an issue caused by your project being null-safe and importing an older not-null-safe library. You've got a few options, you can: check for an updated version (possibly pre-release or beta) of splashscreen that supports null-safety; stop using the splashscreen library; migrate splashscreen to null-safety yourself and open a PR; wait for the author to update the library. – Alex Meuer Aug 22 '21 at 09:50

2 Answers2

5

Your project cannot opt in to null-safety because one of its dependent packages (splashscreen) has not been migrated to null-safety yet.

https://dart.dev/null-safety/migration-guide

When all of an app’s direct dependencies support null safety, you can run the app with sound null safety.

You can either

  • Ignore the warning and keep using the package at your own risk. You can disable the warning using:

    // ignore: import_of_legacy_library_into_null_safe
    
  • Downgrade your app or each file's Dart SDK version (to 2.11 or older).

  • Do not use the unmigrated package and remove from dependencies.

Swift Kim
  • 396
  • 1
  • 8
2

you can ignore this with :

// ignore: import_of_legacy_library_into_null_safe
Mohammad Shamsi
  • 521
  • 4
  • 11