为什么这里的不能识别Authservice
void main() => runApp(
ChangeNotifierProvider<AuthService>(
create: (context) => AuthService(),
child: MyApp(),
)
);
这是pubsec文件
version: 1.0.0+1 environment: sdk: ">=2.1.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: ^0.1.2 flutter_blue: ^0.6.3+1 provider: ^4.0.4 firebase_core: ^0.4.4 firebase_auth: ^0.15.4 cloud_firestore: ^0.13.3 auth: ^4.2.0
这是生成错误日志编译器消息:lib/main.dart:9:26:错误:"AuthService"不是类型
变更通知提供者(^^^^^^^^^^^lib/main.dart:10:28:错误:找不到方法:"AuthService"。create:(context(=>AuthService((,^^^^^^^^^^^lib/main.dart:9:3:错误:类型参数"无效类型"不符合绑定的"ChangeNotificationer"ChangeNotificationerProvider"上类型变量"T"的。-"ChangeNotificationer"来自"package:flutter/src/foundation/change_notifier.dart"('../../Downloads/flutter_windows_v1.12.13+hotfix.8-stable/src/flutter/packages/flutter/lib/src/foundation/change_notifier.dart'(。尝试更改类型参数,使其符合边界
ChangeNotificationProvider(^../../Downloads/flutter_windows_v1.12.13+hotfix.8-stable/src/flutter/.pub cache/hosts/pub.dartlang.org/provider-4.0.4/lib/src/change_notifier_provider.dart:98:30:上下文:这是绑定不符合的类型变量。类ChangeNotificationProvider扩展ListableProvider{^lib/main.dart:24:29:错误:"AuthService"不是类型。future:Provider.of(context(.getUser((,^^^^^^^^^^^lib/login_page.dart:53:45:错误:"AuthService"不是类型。wait Provider.of(context(.logUser(^^^^^^^^^^^目标kernel_snapshot失败:异常:创建快照期间出错:null生成失败。失败:生成失败,出现异常。
其中:脚本"C:\Users\sqandil\Downloads\flutter_windows_v1.12.13+修补程序.8-stable\src\flutter\packages\flutter_tools\gradle\flutter.gradle"线路:780
出现问题:任务":app:compileFlutterBuildDebug"的执行失败。
处理"命令"C:\Users\sqandil\Downloads\flutter_windows_v1.12.13+hotfix.8-stable\src\flutter\bin\flutter.bat"以非零退出值1 结束
Try:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--scan运行以获得完整的见解。
获取更多帮助,请访问https://help.gradle.org
BUILD在14秒内失败已完成,返回错误:Gradle任务assemblyDebug失败,退出代码为1
您应该以这种方式导入import 'package:auth/auth.dart