android - 因为来自 sdk 的 flutter_test 的每个版本都依赖于路径 1.8.1,而 easy_localization 3.0.0 依赖于路径 >=1.8.0-nullsafety

标签 android flutter dart gradle sdk

因为来自 sdk 的 flutter_test 的每个版本都依赖于路径 1.8.1,而 easy_localization 3.0.0 依赖于路径 >=1.8.0-nullsafety <=1.8.0,所以来自 sdk 的 flutter_test 与 easy_localization 不兼容
3.0.0。
并且因为没有任何版本的easy_localization 匹配>3.0.0 <4.0.0,所以来自sdk 的flutter_test 与easy_localization ^3.0.0 不兼容。
所以,因为 zcart 依赖于来自 sdk 的 easy_localization ^3.0.0 和 flutter_test,所以版本求解失败了。
在 zcart 中运行“flutter pub get”...
pub get failed (1; 所以,因为 zcart 依赖于来自 sdk 的 easy_localization ^3.0.0 和 flutter_test,版本求解失败。)
----------------------------------------main.dart-------- --------------

import 'package:easy_dynamic_theme/easy_dynamic_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:nb_utils/nb_utils.dart';
import 'package:zcart/Theme/theme.dart';
import 'package:zcart/config/config.dart';
import 'package:zcart/data/network/api.dart';
import 'package:zcart/helper/constants.dart';
import 'package:zcart/riverpod/providers/logger_provider.dart';
import 'package:zcart/translations/codegen_loader.g.dart';
import 'package:zcart/translations/supported_locales.dart';
import 'views/screens/startup/loading_screen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize the localizations
  await EasyLocalization.ensureInitialized();

  //Shared Pref Initialization
  await initialize();

  //Hive Initialization
  await Hive.initFlutter();
  await Hive.openBox(hiveBox);

  SystemChrome.setPreferredOrientations(
      [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);

  //Run the app
  runApp(
    EasyDynamicThemeWidget(
      child: EasyLocalization(
        path: "assets/translations",
        supportedLocales: supportedLocales,
        fallbackLocale: const Locale("en"),
        assetLoader: const CodegenLoader(),
        child: ProviderScope(
          observers: [Logger()],
          child: const MyApp(),
        ),
      ),
    ),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      supportedLocales: context.supportedLocales,
      localizationsDelegates: context.localizationDelegates,
      locale: context.locale,
      debugShowCheckedModeBanner: false,
      title: API.appName,
      themeMode: MyConfig.isDynamicThemeActive
          ? EasyDynamicTheme.of(context).themeMode == ThemeMode.system
              ? ThemeMode.light
              : EasyDynamicTheme.of(context).themeMode
          : ThemeMode.light,
      theme: AppTheme.light(context),
      darkTheme: AppTheme.dark(context),
      home: const LoadingScreen(),
    );
  }
}

---------------------------------我的 pubspec.yaml---------- -----------------------------------------

#Don't Change anything here
name: zcart
description: A multivendor E commerce App.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev


#Only Chnage this value to update your version
#1.0.0 is version number and 1 is build number
version: 2.0.1+2


#Don't Change Anything From here
environment:
  sdk: '>=2.12.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  flutter_riverpod: ^0.14.0
  http: ^0.13.3
  flutter_widget_from_html: ^0.8.0
  carousel_slider: ^4.0.0
  flutter_rating_bar: ^4.0.0
  shimmer: ^2.0.0
  flutter_slidable: ^0.6.0
  nb_utils: ^4.2.3
  velocity_x: ^3.3.0
  share: ^2.0.1
  datetime_picker_formfield: ^2.0.0
  flutter_countdown_timer: ^4.1.0
  font_awesome_flutter: ^9.1.0
  google_fonts: ^2.1.0
  flutter_spinkit: ^5.0.0
  cupertino_icons: ^1.0.0
  animations: ^2.0.1
  easy_localization: ^3.0.0
  easy_dynamic_theme: ^2.2.0
  google_sign_in: ^5.0.7
  flutter_facebook_auth: ^3.5.1
  hive: ^2.0.4
  hive_flutter: ^1.1.0
  device_info: ^2.0.2
  flutter_credit_card: ^3.0.0
  flutter_paystack: ^1.0.5+1
  flutter_paypal: ^0.0.8
  sign_in_with_apple: ^3.2.0
  url_launcher: ^6.0.12
  razorpay_flutter:
    git:
      url: git://github.com/devShakib015/razorpay-flutter.git



dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_native_splash: ^1.2.1
  flutter_lints: ^1.0.4


flutter:
  uses-material-design: true
  assets:
    - assets/images/
    - assets/translations/

flutter_native_splash:

  # This package generates native code to customize Flutter's default white native splash screen
  # with background color and splash image.
  # Customize the parameters below, and run the following command in the terminal:
  # flutter pub run flutter_native_splash:create
  # To restore Flutter's default white splash screen, run the following command in the terminal:
  # flutter pub run flutter_native_splash:remove

  # color or background_image is the only required parameter.  Use color to set the background
  # of your splash screen to a solid color.  Use background_image to set the background of your
  # splash screen to a png image.  This is useful for gradients. The image will be stretch to the
  # size of the app. Only one parameter can be used, color and background_image cannot both be set.
  color: "#f5f5f5"
  #background_image: "assets/splash.png"

  # Optional parameters are listed below.  To enable a parameter, uncomment the line by removing 
  # the leading # character.

  # The image parameter allows you to specify an image used in the splash screen.  It must be a 
  # png file and should be sized for 4x pixel density.
  image: assets/images/splash.png

  # The color_dark, background_image_dark, and image_dark are parameters that set the background
  # and image when the device is in dark mode. If they are not specified, the app will use the
  # parameters from above. If the image_dark parameter is specified, color_dark or 
  # background_image_dark must be specified.  color_dark and background_image_dark cannot both be
  # set.
  #color_dark: "#042a49"
  #background_image_dark: "assets/dark-background.png"
  #image_dark: assets/splash-invert.png

  # The android, ios and web parameters can be used to disable generating a splash screen on a given 
  # platform.
  #android: false
  #ios: false
  #web: false

  # The position of the splash image can be set with android_gravity, ios_content_mode, and
  # web_image_mode parameters.  All default to center.
  #
  # android_gravity can be one of the following Android Gravity (see 
  # https://developer.android.com/reference/android/view/Gravity): bottom, center, 
  # center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal,
  # fill_vertical, left, right, start, or top.
  #android_gravity: center
  #
  # ios_content_mode can be one of the following iOS UIView.ContentMode (see 
  # https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill, 
  # scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight, 
  # bottomLeft, or bottomRight.
  #ios_content_mode: center
  #
  # web_image_mode can be one of the following modes: center, contain, stretch, and cover.
  #web_image_mode: center

  # To hide the notification bar, use the fullscreen parameter.  Has no affect in web since web 
  # has no notification bar.  Defaults to false.
  # NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads.
  #       To show the notification bar, add the following code to your Flutter app:
  #       WidgetsFlutterBinding.ensureInitialized();
  #       SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
  fullscreen: true

  # If you have changed the name(s) of your info.plist file(s), you can specify the filename(s)
  # with the info_plist_files parameter.  Remove only the # characters in the three lines below,
  # do not remove any spaces:
  #info_plist_files:
  #  - 'ios/Runner/Info-Debug.plist'
  #  - 'ios/Runner/Info-Release.plist'

  # To enable support for Android 12, set the following parameter to true.  Defaults to false.
  #android12: true

最佳答案

我为我解决了。运行此命令:

dart pub upgrade --null-safety
此命令将所有库升级到空安全版本。在优化您的代码以实现零安全性之后。运行此命令时,您只能看到可升级的库:
dart pub upgrade --null-safety --dry-run

关于android - 因为来自 sdk 的 flutter_test 的每个版本都依赖于路径 1.8.1,而 easy_localization 3.0.0 依赖于路径 >=1.8.0-nullsafety,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70680482/

相关文章:

http - 加载数据时客户端异常

swift - 如何在 Flutter 中实现 3D Secure(通过 Visa/MasterCard SecureCode 验证)?

flutter - flutter ,显示问题实例

java - libGDX 暂停运行几秒钟

java - Android 应用程序在启动时崩溃

如果不创建则 Flutter Firestore 更新(如果存在)

flutter |右对齐不起作用

Android如何在后退时关闭正在运行的应用程序?

Android Studio 'Device Only' 位置 w/Google Play 服务不工作

flutter - 如何使用Flutter确定Cloud Firestore查询是否为假?