Flutter pub get failed with intl

Viewed 6817

My app was working yesterday but today, I'm getting the error below when I try to run pub get, so where am I doing wrong, tried to add intl: 0.17.0-nullsafety.2 but it didn't work, thanks in advance.

Edit

changing intl: 0.17.0-nullsafety to intl: ^0.16.1` , does not change anything

Error

    flutter pub get
    Running "flutter pub get" in koygitsin...                       
    Because every version of date_time_picker depends on intl ^0.16.1 and temp_name depends on intl 0.17.0-nullsafety.2, date_time_picker is forbidden.
    
    So, because temp_name depends on date_time_picker ^1.0.1, version solving failed.
    pub get failed (1; So, because temp_name depends on date_time_picker ^1.0.1, version solving failed.)

exit code 1

pubspec yaml

dependencies:
  flutter:
    sdk: flutter
    


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0
  font_awesome_flutter: ^8.10.0
  carousel_slider: ^2.3.1
  firebase_ml_vision: ^0.9.10
  firebase_core: ^0.5.1
  firebase_auth: ^0.18.3
  firebase_messaging: ^7.0.3
  firebase_database: ^4.3.0
  firebase_storage: ^5.0.1
  image_picker: ^0.6.7+12
  cloud_firestore: ^0.14.3
  item_selector: ^0.1.1
  flutter_staggered_animations: ^0.1.2
  modal_progress_hud: ^0.1.3
  convex_bottom_bar: ^2.6.0
 
  google_fonts: ^1.1.1
  animations: ^1.1.2
  path_provider: ^1.6.24
  auto_size_text_field: ^0.1.7
  intl: 0.17.0-nullsafety.2
  flutter_bloc: ^6.1.1
  flutter_picker: ^1.1.5
  date_time_picker: ^1.0.1
  sliding_up_panel: ^1.0.2
  flutter_onboard: ^0.1.0
  image_crop: ^0.3.4
  audioplayer: ^0.8.1
  flutter_countdown_timer: ^1.6.0
  shared_preferences: 0.5.12+4
  argon_buttons_flutter: ^1.0.6
  cached_network_image: ^2.4.1
  material_floating_search_bar: ^0.2.4
  flutter_neumorphic: ^3.0.3
3 Answers

This happens because date_time_picker depends on intl ^0.16.1

1.Add this to your package's pubspec.yaml file:

dependency_overrides:
 intl: ^0.16.1` 

EDIT:

or

Try adding this command in pubspec.yaml file:

dependency_overrides:
 intl: any

2.Run with Flutter:

$ flutter pub get

3.Import it now in your Dart code, you can use:

import 'package:intl/intl.dart';

Change version of your intl package to

intl ^0.16.1

in your pubspec.yaml file from

intl: 0.17.0-nullsafety.2

Your package versions not working together, giving error because of this. Be sure of your dependencies are last version.

https://pub.dev/

Related