【问题标题】:flutter getx package not working, showing error颤振getx包不起作用,显示错误
【发布时间】:2021-02-20 23:38:36
【问题描述】:

我最近升级了颤振。升级后,当我要使用 Get 时,它会显示错误。 不添加 get 我的项目工作正常。

代码

import 'package:flutter/material.dart';
import 'package:flutterfire_auth/src/homepage.dart';
import 'package:get/get.dart';

void main() {
  return runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Flutter App',
      debugShowCheckedModeBanner: false,
      home: Homepage(),
    );
  }
}

错误

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:235:37: Error: No named parameter with the name 'shadowThemeOnly'.
    final theme = Theme.of(context, shadowThemeOnly: true);
                                    ^^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^

【问题讨论】:

  • 将此添加到您的包的 pubspec.yaml 文件中:dependencies: get: ^3.15.0。您可以从命令行安装软件包:flutter pub get。现在在你的 Dart 代码中,你可以使用:import 'package:get/get.dart';。这适合你吗?

标签: flutter flutter-getx


【解决方案1】:

在 vscode“Pubspec 依赖搜索”中添加 pub 依赖扩展,这将有助于自动添加“get”依赖

【讨论】:

    猜你喜欢
    • 2021-11-03
    • 2022-01-05
    • 2020-04-08
    • 1970-01-01
    • 2021-06-26
    • 2020-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多