uni_auth 1.0.19 copy "uni_auth: ^1.0.19" to clipboard
uni_auth: ^1.0.19 copied to clipboard

UniAuth is a Flutter package designed to handle authentication modules in Flutter applications.

example/lib/main.dart

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:uni_auth/uni_auth.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  UniAuth.init(
    auth: FirebaseAuth.instance,
    locale: const Locale('en'),
    baseUrl: 'YOUR_BASE_URL',
  );

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Uni-Auth-Example',
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.teal,
          title: const Text('Uni-Auth-Example',
              style: TextStyle(color: Colors.white)),
        ),
        body: Padding(
          padding: const EdgeInsets.all(14),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              const Text('Create User With Email & Password'),
              ElevatedButton(
                onPressed: () async {
                  final result = await UniAuthService.createUserWithEmail(
                    authData: AuthData(
                      email: 'YOUR_EMAIL',
                      password: 'YOUR_PASSWORD',
                    ),
                  );
                  if (result.isSuccess) {
                    debugPrint('User Created : ${result.user}');
                  } else {
                    debugPrint('Error : ${result.errorMessage}');
                  }
                },
                child: const Text('Create User'),
              ),
              const Text('Check If User Logged In'),
              ElevatedButton(
                onPressed: () async {
                  final result = UniAuthService.checkUserLoggedIn;
                  debugPrint('User Logged In : $result');
                },
                child: const Text('Check If User Logged In'),
              ),
              const SizedBox(height: 10),
              CheckSignInState(
                holder: const Text('Check If User Logged In Wrapper Builder'),
                onLoggedIn: () {
                  debugPrint('User Logged In');
                },
                onNotLoggedIn: () {
                  debugPrint('User Not Logged In');
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
150
points
127
downloads

Publisher

verified publisherunicodesolutions.co

Weekly Downloads

UniAuth is a Flutter package designed to handle authentication modules in Flutter applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

firebase_auth, firebase_core, flutter, http

More

Packages that depend on uni_auth