dart migrate gives error in my own code files
Asked Answered
R

1

10

When I run "dart migrate" for enabling null-safety, it gives me following output.


Before migrating your package, we recommend ensuring that every library it
imports (either directly or indirectly) has been migrated to null safety, so
that you will be able to run your unit tests in sound null checking mode.  You
are currently importing the following non-null-safe libraries:

  package:stepfly/common/Functions/Constants/constants.dart
  package:stepfly/common/Functions/Utils/random_string.dart
  package:stepfly/common/Functions/Utils/timeUtils.dart
  package:stepfly/common/Functions/Utils/utilExam.dart
  package:stepfly/common/Functions/Utils/utilInternet.dart
  package:stepfly/common/Functions/Utils/utils.dart
  package:stepfly/common/Functions/Utils/utilsResourse.dart
  package:stepfly/common/Functions/Utils/utilsUserData.dart
  package:stepfly/common/Responsive/enums/device_screen_type.dart
  package:stepfly/common/Responsive/platformInfo.dart
  package:stepfly/common/Responsive/responsive/responsive_builder.dart
  ......

Please upgrade the packages containing these libraries to null safe versions
before continuing.  To see what null safe package versions are available, run
the following command: `dart pub outdated --mode=null-safety`.

To skip this check and try to migrate anyway, re-run with the flag
`--skip-import-check`

While these files are my own code files.

running following command dart pub outdated --mode=null-safety give me the output as follows:

Showing dependencies that are currently not opted in to null-safety.
[✗] indicates versions without null safety support.
[✓] indicates versions opting in to null safety.

Computing null safety support...
All your dependencies declare support for null-safety.

How do I use dart migrate tool to migrate my flutter code to null safety

Rainstorm answered 6/7, 2021 at 4:17 Comment(0)
R
4

If I understand correctly your files import other files from your own lib. These files have not been migrated to null safety yet (since that is what you want to do), that's why you get this error.

Try running it again with the mentioned

To skip this check and try to migrate anyway, re-run with the flag
`--skip-import-check`

I had the same issue. After migrating it using this flag it all works fine now.

Revision answered 6/7, 2021 at 10:1 Comment(1)
Yes, I did like this only. I was left with around 600 errors in the console. Had to solve them manually afterwards.Rainstorm

© 2022 - 2024 — McMap. All rights reserved.