0

I have this libraries in my project:

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  after_layout: ^1.1.0
  alt_sms_autofill: ^1.0.0
  another_flushbar: ^1.10.24
  avatar_glow: ^2.0.2
  barcode_scan2: ^4.1.4
  camera: ^0.9.2+2
  carousel_slider: ^4.0.0
  catcher: ^0.6.8
  charts_flutter: ^0.11.0
  contacts_service: ^0.6.3
  crypto: ^3.0.1
  cryptography: ^2.0.2
  cupertino_icons: ^1.0.3
  device_info: ^2.0.3
  dio: ^4.0.1
  dotted_border: ^2.0.0+1
  encrypt: ^5.0.1
  file_picker: ^4.2.0
  firebase_messaging: ^10.0.9
  flutter:
    sdk: flutter
  flutter_inappwebview: ^5.3.2
  flutter_keyboard_visibility: ^5.1.0
  flutter_rating_bar: ^4.0.0
  flutter_slidable: ^0.6.0
  flutter_svg: ^0.23.0+1
  fluttertoast: ^8.0.8
  font_awesome_flutter: ^9.2.0
  geolocator: ^7.7.1
  get_it: ^7.1.3
  hive: ^2.0.4
  hive_flutter: ^1.1.0
  http: ^0.13.3
  image_cropper: ^1.4.1
  image_gallery_saver: ^1.7.1
  image_picker: ^0.8.4+1
  installed_apps: ^1.2.0
  intl: ^0.17.0
  introduction_screen: ^2.1.0
  json_annotation: ^4.0.1
  local_auth: ^1.1.7
  logger: ^1.1.0
  mask_text_input_formatter: ^2.0.0
  otp: ^3.0.1
  overlay_support: ^1.2.1
  package_info_plus: ^1.3.0
  page_view_indicators: ^2.0.0
  path_provider: ^2.0.4
  permission_handler: ^8.1.6
  persian: ^1.1.1
  persian_datetime_picker:
    path: packages/persian_datetime_picker
  persian_number_utility: ^1.1.0
  provider: ^6.0.1
  quick_actions: ^0.6.0+6
  retrofit: ^2.1.0
  rxdart: ^0.27.2
  screenshot: ^1.2.3
  shared_preferences: ^2.0.7
  sqflite: ^2.0.0+4
  timezone: ^0.8.0
  universal_html: ^2.0.8
  url_launcher: ^6.0.10
  url_strategy: ^0.2.0
  uuid: ^3.0.5
  video_player: ^2.2.3
  visibility_detector: ^0.2.2
  wc_flutter_share: ^0.4.0
  webview_flutter: ^2.0.13

dev_dependencies:
  build_runner: ^2.1.2
  flutter_localizations:
    sdk: flutter
  flutter_test:
    sdk: flutter
  hive_generator: ^1.1.1
  http_mock_adapter: ^0.3.2
  json_serializable: ^4.1.4
  mockito: ^5.0.15
  retrofit_generator: ^2.0.1

I run this command and It's result:

$ flutter pub upgrade --null-safety
Resolving dependencies...
  _fe_analyzer_shared 22.0.0 (30.0.0 available)
  after_layout 1.1.0
  alt_sms_autofill 1.0.0
  analyzer 1.7.1 (2.7.0 available)
  another_flushbar 1.10.24
  args 2.3.0
  asn1lib 1.0.2
  async 2.5.0 (2.8.2 available)
  avatar_glow 2.0.2
  barcode_scan2 4.1.4
  base32 2.1.1
  boolean_selector 2.1.0
  build 2.1.0 (2.1.1 available)
  build_config 1.0.0
  build_daemon 3.0.0 (3.0.1 available)
  build_resolvers 2.0.4
  build_runner 2.1.2 (2.1.4 available)
  build_runner_core 7.1.0 (7.2.2 available)
  built_collection 5.1.1
  built_value 8.1.3
  camera 0.9.2+2 (0.9.4+3 available)
  camera_platform_interface 2.1.1
  carousel_slider 4.0.0
  catcher 0.6.8
  characters 1.1.0 (1.2.0 available)
  charcode 1.2.0 (1.3.1 available)
  charts_common 0.11.0 (0.12.0 available)
  charts_flutter 0.11.0
  checked_yaml 2.0.1
  cli_util 0.3.5
  clock 1.1.0
  code_builder 4.1.0
  collection 1.15.0
  contacts_service 0.6.3
  convert 3.0.1
  cross_file 0.3.2
  crypto 3.0.1
  cryptography 2.0.2
  csslib 0.17.1
  cupertino_icons 1.0.3
  dart_style 2.1.1 (2.2.0 available)
  device_info 2.0.3
  device_info_platform_interface 2.0.1
  device_info_plus 2.2.0 (3.1.0 available)
  device_info_plus_linux 2.1.0
  device_info_plus_macos 2.2.0
  device_info_plus_platform_interface 2.2.0
  device_info_plus_web 2.1.0
  device_info_plus_windows 2.1.0
  dio 4.0.1
  dio_http 5.0.4
  dots_indicator 2.0.0
  dotted_border 2.0.0+1
  encrypt 5.0.1
  fake_async 1.2.0
  ffi 1.1.2
  file 6.1.2
  file_picker 4.2.0
  firebase_core 1.8.0
  firebase_core_platform_interface 4.0.1
  firebase_core_web 1.1.0
  firebase_messaging 10.0.9
  firebase_messaging_platform_interface 3.0.7
  firebase_messaging_web 2.0.7
  fixnum 1.0.0
  flutter 0.0.0 from sdk flutter
  flutter_inappwebview 5.3.2
  flutter_keyboard_visibility 5.1.0
  flutter_keyboard_visibility_platform_interface 2.0.0
  flutter_keyboard_visibility_web 2.0.0
  flutter_localizations 0.0.0 from sdk flutter
  flutter_mailer 2.0.0
  flutter_plugin_android_lifecycle 2.0.4
  flutter_rating_bar 4.0.0
  flutter_slidable 0.6.0
  flutter_svg 0.23.0+1
  flutter_test 0.0.0 from sdk flutter
  flutter_web_plugins 0.0.0 from sdk flutter
  fluttertoast 8.0.8
  font_awesome_flutter 9.2.0
  frontend_server_client 2.1.2
  geolocator 7.7.1
  geolocator_android 2.1.0
  geolocator_apple 1.2.2
  geolocator_platform_interface 2.3.6
  geolocator_web 2.0.6
  get_it 7.1.3 (7.2.0 available)
  glob 2.0.1 (2.0.2 available)
  graphs 2.1.0
  hive 2.0.4
  hive_flutter 1.1.0
  hive_generator 1.1.1
  html 0.15.0
  http 0.13.3 (0.13.4 available)
  http_mock_adapter 0.3.2
  http_multi_server 3.0.1
  http_parser 4.0.0
  image_cropper 1.4.1
  image_gallery_saver 1.7.1
  image_picker 0.8.4+1 (0.8.4+4 available)
  image_picker_for_web 2.1.4
  image_picker_platform_interface 2.4.1
  installed_apps 1.2.0
  intl 0.17.0
  introduction_screen 2.1.0
  io 1.0.3
  js 0.6.3
  json_annotation 4.0.1 (4.3.0 available)
  json_serializable 4.1.4 (6.0.1 available)
  local_auth 1.1.7 (1.1.8 available)
  logger 1.1.0
  logging 1.0.2
  mailer 5.0.2
  mask_text_input_formatter 2.0.0
  matcher 0.12.10 (0.12.11 available)
  meta 1.3.0 (1.7.0 available)
  mime 1.0.1
  mockito 5.0.15 (5.0.16 available)
  nested 1.0.0
  otp 3.0.1
  overlay_support 1.2.1
  package_config 2.0.2
  package_info_plus 1.3.0
  package_info_plus_linux 1.0.3
  package_info_plus_macos 1.3.0
  package_info_plus_platform_interface 1.0.2
  package_info_plus_web 1.0.4
  package_info_plus_windows 1.0.4
  page_view_indicators 2.0.0
  path 1.8.0
  path_drawing 0.5.1+1
  path_parsing 0.2.1
  path_provider 2.0.4 (2.0.6 available)
  path_provider_linux 2.1.0
  path_provider_macos 2.0.2
  path_provider_platform_interface 2.0.1
  path_provider_windows 2.0.3
  pedantic 1.11.1 (discontinued replaced by lints)
  permission_handler 8.1.6 (8.2.5 available)
  permission_handler_platform_interface 3.6.1 (3.7.0 available)
  persian 1.1.1
  persian_datetime_picker 2.0.0 from path packages/persian_datetime_picker
  persian_number_utility 1.1.0
  petitparser 4.1.0 (4.4.0 available)
  platform 3.0.2
  plugin_platform_interface 2.0.2
  pointycastle 3.3.5
  pool 1.5.0
  process 4.2.3 (4.2.4 available)
  protobuf 2.0.0
  provider 6.0.1
  pub_semver 2.1.0
  pubspec_parse 1.0.0 (1.1.0 available)
  quick_actions 0.6.0+6 (0.6.0+7 available)
  quick_actions_platform_interface 1.0.0
  quiver 3.0.1+1
  retrofit 2.1.0
  retrofit_generator 2.0.1 (2.1.0+1 available)
  rxdart 0.27.2
  screenshot 1.2.3
  sentry 5.1.0 (6.0.1 available)
  shamsi_date 0.16.0
  shared_preferences 2.0.7 (2.0.8 available)
  shared_preferences_linux 2.0.2
  shared_preferences_macos 2.0.2
  shared_preferences_platform_interface 2.0.0
  shared_preferences_web 2.0.2
  shared_preferences_windows 2.0.2
  shelf 1.2.0
  shelf_web_socket 1.0.1
  sky_engine 0.0.99 from sdk flutter
  source_gen 1.0.3 (1.1.1 available)
  source_helper 1.3.0
  source_span 1.8.0 (1.8.1 available)
  sqflite 2.0.0+4
  sqflite_common 2.0.1+1
  stack_trace 1.10.0
  stream_channel 2.1.0
  stream_transform 2.0.0
  string_scanner 1.1.0
  synchronized 3.0.0
  term_glyph 1.2.0
  test_api 0.2.19 (0.4.7 available)
  timezone 0.8.0
  timing 1.0.0
  tuple 2.0.0
  typed_data 1.3.0
  universal_html 2.0.8
  universal_io 2.0.4
  url_launcher 6.0.10 (6.0.12 available)
  url_launcher_linux 2.0.2
  url_launcher_macos 2.0.2
  url_launcher_platform_interface 2.0.4
  url_launcher_web 2.0.4
  url_launcher_windows 2.0.2
  url_strategy 0.2.0
  uuid 3.0.5
  vector_math 2.1.0 (2.1.1 available)
  video_player 2.2.3 (2.2.6 available)
  video_player_platform_interface 4.2.0
  video_player_web 2.0.4
  visibility_detector 0.2.2
  watcher 1.0.0 (1.0.1 available)
  wc_flutter_share 0.4.0
  web_socket_channel 2.1.0
  webview_flutter 2.0.13 (2.1.2 available)
  win32 2.0.5 (2.2.10 available)
  xdg_directories 0.2.0
  xml 5.1.2 (5.3.1 available)
  yaml 3.1.0
No dependencies changed.
43 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

No changes to pubspec.yaml!

Why I cant update my libs, I want to migrate my old project to null safety?

Cyrus the Great
  • 5,145
  • 5
  • 68
  • 149
  • Did you try `flutter pub outdated`? – NirmalCode Nov 02 '21 at 20:21
  • `packages have newer versions incompatible with dependency constraints` That tells you right there. You have packages that have dependency issues. It can be a pain to weed these out. IDEs can sometimes help. VS Code shows some of the error details in the "OUTPUT" terminal window. ‍♂️ – daddygames Nov 02 '21 at 20:22
  • Yes, just shows that libraries must be updated @NirmalCode – Cyrus the Great Nov 02 '21 at 20:22
  • 1
    My suggestion is to upgrade lib versions manually so that you know which are upgraded. Also, there can be breaking changes, dependency changes. – NirmalCode Nov 02 '21 at 20:22
  • I do that, but I got error to my model that generated by json serilaizer – Cyrus the Great Nov 02 '21 at 20:23
  • If a package has null-safety version, I recommend to upgrade to it. However, you have to be careful of packages that share dependencies. You have to find packages whose versions can be as up to date as possible while maintaining compatibility with each other. – daddygames Nov 02 '21 at 20:24
  • I manually updated but I got this error `Because url_launcher 6.0.12 requires SDK version >=2.14.0 <3.0.0 and no versions of url_launcher match >6.0.12 <7.0.0, url_launcher ^6.0.12 is forbidden.` @daddygames – Cyrus the Great Nov 02 '21 at 20:26
  • Your pubspec has `sdk: ">=2.7.0 <3.0.0"` which does not meet the requirements of the version of url_launcher you are trying to use. You would need to update to `sdk: ">=2.14.0 <3.0.0"` However, this will require all packages have null-safety. Therefore you may need to downgrade the version of url_launcher you use. – daddygames Nov 02 '21 at 20:30

1 Answers1

0

First backup your project for safety.

Try this,

flutter clean

Now delete pubspec.lock file.

Now delete all the versions from pubspec.yaml.

Leaving version number empty, let flutter decide which to use.

Upgrade SDK version,

environment:
  sdk: ">=2.14.0 <3.0.0"

Now run,

flutter pub get
NirmalCode
  • 2,140
  • 1
  • 14
  • 19