kimko_auth

Last updated:

0 purchases

kimko_auth Image
kimko_auth Images
Add to Cart

Description:

kimko auth

kimko_auth #
Overview #
The Kimiko Auth Library for Flutter provides a robust solution for managing user authentication in your Flutter applications. It supports various operations like login, signup, logout, getting user details, updating profile details, updating profile images, and deactivating accounts.
Table of Contents

Installation
Usage
Public Methods
Example Code
Unique App IDs

Installation #
To use the Auth Library in your Flutter project, add it to your pubspec.yaml file:
yaml
dependencies:
kimko_auth: ^1.0.4
copied to clipboard
Run
dart flutter pub get
copied to clipboard
To install the new dependency.
Usage #
After adding the Auth Library to your project, you can start using it by importing the package and initializing the KimkoAuth.
Initialize the Library
import 'package:flutter/material.dart';
import 'package:kimko_auth/kimko_auth.dart';

KimkoAuth kimkoAuth = KimkoAuth();

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await KimkoAuth.initialize(teamId: 'angrybird-kimiko-f06');

runApp(const MyApp());
}
copied to clipboard
Kimiko response #
class KimikoResponse {
final dynamic data;
final String? error;
final int? statusCode;

KimikoResponse( {this.data, this.error, this.statusCode});

bool get isSuccess => error == null;
}

dart
class KimikoException implements Exception {
final String? error;

KimikoException({this.error});
}
copied to clipboard
Kimiko User json #
{
"id": "",
"first_name": "",
"last_name": "",
"is_active": true,
"email": "[email protected]",
"avatar_url": ""
}
copied to clipboard
Sign UP functionality #
Returns:
Future<KimikoResponse>
containing the user response
copied to clipboard
Example:
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController fNameController = TextEditingController();
TextEditingController lNameController = TextEditingController();
TextEditingController userNameController = TextEditingController();

Future<void> signUp() async {
try {
var res = await kimkoAuth.signup(
username: userNameController.text.trim(),
email: emailController.text.trim(),
password: passwordController.text.trim(),
firstName: fNameController.text.trim(),
lastName: lNameController.text.trim());
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (_) => const LoginScreen()));
} on KimikoException catch (e) {
print('Kimiko ${e.error}');
} catch (e) {
print("Another error $e");
}
}
copied to clipboard
Sign in functionality #
Returns:
Future<KimikoResponse>
containing the user response
copied to clipboard
Example:
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();

Future<void> signIn(BuildContext context) async {
try {
var res = await kimkoAuth.signIn(
email: emailController.text.trim(),
password: passwordController.text.trim());
} on KimikoException catch (e) {
print('Kimiko ${e.error}');
} catch (e) {
print("Another error $e");
}
}
copied to clipboard
Get User #
Get user details from api
Returns:
Future<KimikoResponse>
containing the user response
copied to clipboard
Example:
Future<void> getUser() async {
try {
var res = await kimkoAuth.getUser();
print(res.data);
if (res.data != null) {
setState(() {
user.value = res.data['data'];
});
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => const ProfileScreen()));
}
} on KimikoException catch (e) {
debugPrint('Kimiko ${e.error}');
errorSnack(e.error.toString(), context: context);
} catch (e) {
debugPrint("Another error $e");
errorSnack(e.toString(), context: context);
}

}
copied to clipboard
Get Logged in User #
Logs in a user with the provided email and password.
Returns:
Future<KimikoResponse>
containing the user response
copied to clipboard
Example:
var res = await kimkoAuth.getLoggedInUser();
print(res.data);
copied to clipboard
Update user #
This updates the user's details.
You can update

firstName
lastName
avatarUrl
username

Returns:
Future<KimikoResponse>
containing the user response
copied to clipboard
Example:
Future<void> updateUser() async {
try {
var res = await kimkoAuth.updateUser(
firstName: fNameController.text.trim(),
lastName: lNameController.text.trim(),
avatarUrl: newImageURL,
);
print(res.data);

} on KimikoException catch (e) {
debugPrint('Kimiko ${e.error}');
errorSnack(e.error.toString(), context: context);
} catch (e) {
debugPrint("Another error $e");
errorSnack(e.toString(), context: context);
}
}

copied to clipboard
Log out #
This deletes all the user data and ends session
Returns: #
Future<KimikoResponse>
containing the user response
copied to clipboard
Example: #
var res = await kimkoAuth.logOut();
copied to clipboard
Team IDs #
Team Names and their IDs
Team Kimiko (Flutter Team F) - angrybird-flutter-f01
Flutter Team A - angrybird-kimiko-f06
Team Starlight - heritagequest-starlight-f02
Team Anchor - hockeygame-anchor-f03
Team: Team Kimiko (Telex) #

@krysnkem (GitHub: krysnkem | Slack: @Christian Onyisi)
@andymaking (GitHub: andymaking | Slack: @the_andima)
@adebola-duf (GitHub: adebola-duf | Slack: @bolexyro)
@ManifestJosh (GitHub: ManifestJosh | Slack: @Manifest)

Feel free to reach out to the team for any questions.

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.