Reputation: 117
Why isn't Authservice being recognized here
void main() => runApp(
ChangeNotifierProvider<AuthService>(
create: (context) => AuthService(),
child: MyApp(),
)
);
this is the pubsec file
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
this is the build error log Compiler message: lib/main.dart:9:26: Error: 'AuthService' isn't a type.
ChangeNotifierProvider( ^^^^^^^^^^^ lib/main.dart:10:28: Error: Method not found: 'AuthService'. create: (context) => AuthService(), ^^^^^^^^^^^ lib/main.dart:9:3: Error: Type argument 'invalid-type' doesn't conform to the bound 'ChangeNotifier' of the type variable 'T' on 'ChangeNotifierProvider'. - 'ChangeNotifier' is from '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'). Try changing type arguments so that they conform to the bounds.
ChangeNotifierProvider( ^ ../../Downloads/flutter_windows_v1.12.13+hotfix.8-stable/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-4.0.4/lib/src/change_notifier_provider.dart:98:30: Context: This is the type variable whose bound isn't conformed to. class ChangeNotifierProvider extends ListenableProvider { ^ lib/main.dart:24:29: Error: 'AuthService' isn't a type. future: Provider.of(context).getUser(), ^^^^^^^^^^^ lib/login_page.dart:53:45: Error: 'AuthService' isn't a type. await Provider.of(context).loginUser( ^^^^^^^^^^^ Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.FAILURE: Build failed with an exception.
Where: Script 'C:\Users\sqandil\Downloads\flutter_windows_v1.12.13+hotfix.8-stable\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\Users\sqandil\Downloads\flutter_windows_v1.12.13+hotfix.8-stable\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 14s Finished with error: Gradle task assembleDebug failed with exit code 1
Upvotes: 0
Views: 2192
Reputation:
You should be importing it this way import 'package:auth/auth.dart
Upvotes: 2