'flutter packages get command gives an error error

hello I tried running flutter pub get and I was faced with this error:

 flutter pub get
    Waiting for another flutter command to release the startup lock...
    Running "flutter pub get" in Deutsche-Flutter...                
    Because every version of flutter_test from sdk depends on test_api 0.3.0 and mockito 4.1.4 depends on test_api ^0.2.19-nullsafety, flutter_test from sdk is incompatible with mockito 4.1.4.
    And because no versions of mockito match >4.1.4 <5.0.0, flutter_test from sdk is incompatible with mockito ^4.1.4.
    So, because deutsche depends on both mockito ^4.1.4 and flutter_test any from sdk, version solving failed.
    pub get failed (1; So, because deutsche depends on both mockito ^4.1.4 and flutter_test any from sdk, version solving failed.)
    exit code 1

I already ran flutter upgrade and tried to run flutter pub get here are my dependencies:

environment:
  sdk: ">=2.7.0 <3.0.0"

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
  flutter_svg: ^0.19.1
  flutter_bloc: ^6.1.2
  get: ^3.23.1
  rxdart: ^0.19.0
  http: ^0.12.2
  google_fonts: ^0.3.9
  circular_countdown_timer: ^0.1.0
  pin_code_fields: ^2.4.0
  google_nav_bar: ^3.2.0
  line_icons: ^0.2.0
  shared_preferences: ^0.5.12+4
  flutter_launcher_icons: ^0.7.2+1   
  rive: ^0.6.8
  timer_count_down: ^1.0.4+1
  logger: ^0.9.4
  dartz: ^0.9.0-dev.6
  freezed_annotation: ^0.12.0
  bloc_test: ^7.1.0
  mockito: ^4.1.4
  jwt_decode: ^0.3.1
  carousel_slider: ^3.0.0


dev_dependencies:
  build_runner:
  freezed: ^0.12.7
  flutter_test:
    sdk: flutter


Solution 1:[1]

try replacing mokito version as any as follows.

 mockito: any

then check the pubspeck.lock file and search mokito and take that version number from there and replace it in pubspec.yaml file

Solution 2:[2]

update the mockito package to => mockito: ^5.2.0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lakmal Fernando
Solution 2 Zia Ullah