android: SDK 16+
ios: 11.0+
MacOs: 10.15+
Web: any
then install package
eazy_sign_in: ^any
then button onClick or onTap
make async and then
await AuthService().signInWithGoogle(); // import the file path
full code this page sign in page
import 'package:easy_sign_in/provider/google/auth_services.dart';
import 'package:flutter/material.dart';
void main() {
runApp(
const MaterialApp(
home: MyApp(),
),
);
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () {
EasyAuthManager().signInWithGoogle(); // this
},
child: const Text('Sing In'),
),
),
);
}
}
then main dart set loginPage but when you make products when see the use login the page remove and otherPage show this type set using stream because this wrk basically ui changes real time so use
home: StreamBuilder(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (!snapshot.hasData) { // if login data not exist when show login page
return const LoginPage();
} else { // other wise show this page
return const Scaffold();
}
},
),
then you build apk the app is build but the app doesn't work
firstly enable authentication in google
then android SHA1 and SHA-256 set in firebase project and ios set GoogleService-Info.plist
android set the commend paste to find the key . paste the terminal
./gradlew signingReport
copy and paste android Project settings
SHA1 and SHA-256 set very important
then
clean and build project and make sure the firebase project package name in app package name is same
can you not understand the set up you follow youtube video