-1

I'm trying to build app using hive but the hive_flutter package doesn't supporting null safety.

Is there any way to turn off null safety for this package only or is there any alternative for the hive_flutter package?

jamesdlin
  • 81,374
  • 13
  • 159
  • 204
prathamesh
  • 13
  • 1

2 Answers2

1

To turn off null safety, change sdk environment in pubspec.yaml to this:

environment:
  sdk: ">=2.7.0 <3.0.0"
Hazar Belge
  • 1,009
  • 4
  • 20
0

According to Migrating to null safety, all your dependencies must be migrated to null safety first:

Here are the basic steps for migrating each package that you own:

  1. Wait for the packages that you depend on to migrate.
  2. ...

Migrating an app is technically the same as migrating a package. Before migrating an app, make sure that all of your dependencies are ready.

But hive_flutter supports null safety since version 1.0.0 (March 5 2021). So you should simply upgrade it.

Thomas
  • 174,939
  • 50
  • 355
  • 478