appwrite_auth_kit
Making Appwrite Authentication Easy
- Stars
- 34
- Forks
- 14
- Last push (UTC)
- Aug 2, 2024
- Project status
- Active
Original README
English project snapshot. Visit GitHub for the latest content.
Appwrite Auth Kit
A Flutter wrapper for Appwrite's Accounts service, makes it easy to use manage authentication and account features.
Getting Started
This is really very easy to use
- Add dependency
dependencies:
appwrite_auth_kit: <version>
- Wrap your MaterialApp
AppwriteAuthKitpassing a properly initialized Appwrite Client. Example below:
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
late Client client;
@override
void initState() {
super.initState();
//initialize your client
client = Client();
client
.setEndpoint('https://localhost/v1')
.setProject('60793ca4ce59e')
.setSelfSigned();
}
@override
Widget build(BuildContext context) {
return AppwriteAuthKit(
client: client,
child: MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MainScreen(),
),
);
}
}
- Access
authNotifierfromcontext.authNotifieris an instance ofAuthNotifierthat provides all the functions of Appwrite's Account service and some easy way to handle authentication. - Get
context.authNotifier.statusgets the authentication status which can be one of theAuthStatus.uninitialized,AuthStatus.unauthenticated,AuthStatus.authenticatingandAuthStatus.authenticated. You can check the status and display the appropriate UI, for example
class MainScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final authNotifier = context.authNotifier;
Widget widget;
switch (authNotifier.status) {
case AuthStatus.authenticated:
widget = AdminPage();
break;
case AuthStatus.unauthenticated:
case AuthStatus.authenticating:
widget = LoginPage();
break;
case AuthStatus.uninitialized:
default:
widget = LoadingPage();
break;
}
return widget;
}
}
- You must use the functions from the
context.authNotifierinstead default Account service from Appwrite SDK to create user, create session (login), delete session (logout), so that thecontext.authNotifier?.statusis properly updated and your UI updates accordingly.
LanguagesDartCMakeC++RubySwiftHTMLCKotlinObjective-C
Categories
Dependencies used
Dependency list 4 items
- appwrite
^12.0.0 - flutter
{"sdk":"flutter"} - flutter_lintsDevelopment
^4.0.0 - flutter_testDevelopment
{"sdk":"flutter"}
How do I choose a repository?
Start with your use case, compare repository activity, and check the original project before adopting it.
- Search by repository name, owner or description, then narrow the results by topic.
- Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
- Read the README, license and issues on GitHub before using a project.
Sources and maintenance
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗
- flappwrite/auth_kit · GitHub ↗
- GitHub Docs — Saving repositories with stars ↗
- Directory maintained by Ducafecat ↗