common_authentication

Creator: coderz1093

Last updated:

0 purchases

common_authentication Image
common_authentication Images

Languages

Categories

Add to Cart

Description:

common authentication

Allow common authentication by firebase auth for all platforms
Features #

Login by Google on Mobile, Desktop and Web.

Getting started #
List prerequisites and provide or point to information on how to
start using the package.
Usage #
Include short and useful examples for package users. Add longer examples
to /example folder.
1- In yout app add Auth bloc
return MultiBlocProvider(
providers: [
BlocProvider<AuthBloc>(
create: (_) => AuthBloc(),
),
],
child: MaterialApp(..),
);
copied to clipboard
2-
class LoginPage extends StatefulWidget {
final SignInGoogleQueryParameters? queryParameters;

const LoginPage({Key? key, this.queryParameters}) : super(key: key);

@override
State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
@override
void initState() {
super.initState();
initGoogleSignIn();
context.read<AuthBloc>().add(AuthCheckStatusEvent());
}

@override
Widget build(BuildContext context) {
return BlocListener<AuthBloc, AuthState>(
listener: (context, state) {
if (state is AuthLoggedInState) {
Navigator.of(context).pushReplacementNamed('/home');
}
},
child: const GoogleSignInButton(),
);
}
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.