我们为 web 启用了 Flutter 应用程序,但我们遇到了一些导入错误。所有导入都是有效的并且在 Android 中运行,所以我没有看到问题所在。
我研究了这个特定的导入,并了解到它是由应用程序中有多个 main() 引起的,但其他的是有效的。
import 'generated_plugin_registrant.dart';
从 lbconnect_web|lib/screens/member/test_web_entrypoint.dart 在 5:1
对于似乎没有任何问题的包,还有 10 个其他导入错误。
这些是其他的,每个都有多个错误:
import 'package:lbconnect_web/models/checkin_model.dart';
来自 lbconnect_web|lib/modules/check_in_question.dart 在 4:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
checkin_model 只是一个变量的类,而 cupertino_settings 在我的 pubspec.yaml 中
flutter_cupertino_settings: ^0.0.9+1
编辑 3 - 错误
无法为某些源找到模块,这通常是由于导入错误、包中缺少依赖项(或者可能是 dev_dependency
需要移动到真正的依赖项)或构建失败(如果导入
生成的文件) .
请检查以下导入:
import 'package:lbconnect_web/models/checkin_model.dart';
从 lbconnect_web|lib/screens/member/EmotionalWheel/choose.dart 在 8:1
import 'package:lbconnect_web/models/checkin_model.dart';
从 lbconnect_web|lib/modules/check_in_question.dart 在 4:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
从 lbconnect_web|lib/screens/member/settings_2.0/widgets/selection_fields/card_settings_multiselect .dart 8:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
来自 lbconnect_web|lib/screens/member/settings_2.0/widgets/text_fields/card_settings_text.dart 7:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
来自 lbconnect_web|lib/screens/member/settings_2.0/widgets/numeric_fields/card_settings_switch.dart 8:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
来自 lbconnect_web|lib/screens/member/settings_2.0/widgets/picker_fields/card_settings_time_picker.dart 8:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
来自 lbconnect_web|lib/screens/member/settings_2.0/widgets/picker_fields/card_settings_color_picker.dart 9 :1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
从 lbconnect_web|lib/screens/member/settings_2.0/widgets/picker_fields/card_settings_date_picker.dart 在 8:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
从 lbconnect_web|lib/screens/member/settings_2.0/widgets/numeric_fields/card_settings_slider.dart 在 8:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
从 lbconnect_web |lib/screens/member/settings_2.0/widgets/picker_fields/card_settings_list_picker.dart 8:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
来自 lbconnect_web|lib/screens/member/settings_2.0/widgets/card_settings_panel.dart 7:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
来自 lbconnect_web|lib/screens /member/settings_2.0/widgets/information_fields/card_settings_header.dart 7:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
来自 lbconnect_web|lib/screens/member/settings_2.0/widgets/information_fields/card_settings_instructions.dart 6:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';
来自 lbconnect_web|lib/screens/member /settings_2.0/widgets/action_fields/card_settings_button.dart 在 4:1
无法为某些源找到模块,这通常是由于导入错误、包中缺少依赖项(或者可能是 dev_dependency 需要移动到真正的依赖项)或构建失败(如果导入生成的文件) .
请检查以下导入:
import 'generated_plugin_registrant.dart';
从 lbconnect_web|lib/screens/member/test_web_entrypoint.dart 在 5:1
655ms 后失败 为 Web 构建应用程序... 31.1s 为 Web 构建应用程序失败。
编辑 2 - 检查模型
class CheckInModel {
String checkInId;
CheckInModel({this.checkInId});
factory CheckInModel.fromJson(Map<String, dynamic> json) {
return CheckInModel(
checkInId: json['CheckInID'],
);
}
}
编辑
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: ^0.1.2
rxdart: ^0.22.0
provider: ^3.0.0+1
shared_preferences: 0.5.2
flutter_local_notifications:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_redux: ^0.5.2
snaplist: ^0.1.3
font_awesome_flutter: ^8.0.1
http: ^0.12.0
intl: ^0.15.7
device_calendar: ^0.0.7
dynamic_theme:
eva_icons_flutter:
flutter_speed_dial:
sqflite:
url_launcher: ^5.0.3
swipedetector: ^1.2.0
contacts_service: ^0.2.1
agora_rtc_engine: 1.0.5
permission_handler: ^3.0.0
validators: ^2.0.0
path_provider: ^1.1.0
share_extend: ^1.0.9
shimmer: ^1.0.0
flutter_launcher_icons: ^0.7.2
flutter_tableview:
flutter_masked_text: ^0.8.0
flutter_colorpicker: ^0.2.6
meta: ^1.1.6
auto_size_text: ^1.0.0
flutter_email_sender: ^2.0.3
fl_chart: ^0.2.0
flutter_sms: ^1.0.1
firebase_messaging: ^5.1.1
image_picker: 0.6.0+17
carousel_slider: ^1.3.0
sliding_up_panel:
scoped_model: ^1.0.1
awesome_dialog: ^0.0.4
flutter_icons:
android: "launcher_icon"
ios: false
image_path: "assets/logo/ic_launcher.png"
flutter_email_sender:
path: ../
flutter_cupertino_settings: ^0.0.9+1