Skip to main content ppwriters

Creating account for your user

Create account for your user in Appwrite


In this lesson, we will learn to create an account for our user in Appwrite.

Sign up screen

Create a screen where user can provide their details to create an account.

Copy all the files in the linked folder to your project.


├── signup_screen.dart
└── src
    ├── signup_form.dart
    ├── signup_screen.dart
    └── types.dart

Creating account

In lib/appwrite/appwrite.dart file

  • instantiate Account service from Appwrite SDK
  • call create method on the service to create an account for the user
  • code in github
class Appwrite {
  final Client client = Client();
  late final Account account;
  Appwrite() {

    // Instantiate Appwrite Account service
    account = Account(client);

  Future<User?> createAccount(String name, String email, String password) async {
    try {
      // create account for the user with the provided
      // name, email and password
      final user = await account.create(
        email: email,
        password: password,
        name: email,
      return user;
    } on AppwriteException catch (e) {
      // catch the AppwriteException thrown by the SDK
      return null;

Update home page to add navigation to sign up screen

In lib/home_page/home_page.dart file

  onPressed: () {
    // navigate to sign up screen
  child: const Text('Create account'),

Add signup screen to router

In lib/router/router.dart file

  path: '/signup',
  builder: (_, __) {
    return SignupScreen(onSignup: (name, email, password) async {
      debugPrint('$name - $email - $password');
      // get the instance of Appwrite class that we defined
      // in the dependencies using GetIt
      final appwrite = GetIt.instance.get<Appwrite>();

      // call the createAccount method on the Appwrite class
      final user = await appwrite.createAccount(name, email, password);
      debugPrint(jsonEncode(user?.toMap() ?? '{}'));
  • You can now run the app and create an account for your user.
  • Once created you can visit the Appwrite dashboard and see the user in the Auth section of the corresponding project.

You are currently learning Flutter & Appwrite. An ultimate course to build cross-platform applications using Flutter - the cross-platform application development framework by Google and Appwrite - the open source backend as a service.