Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flappwrite account kit

a flutter wrapper for appwrite’s accounts service, makes it easy to use manage authentication and account features.

under development. not ready for production. help get ready for production.

getting started

this is really very easy to use

  1. add dependency from git (will only publish to pub if enough people are interested to use and help make it better.)

    dependencies:
    flappwrite_account_kit:
    git: https://github.com/lohanidamodar/flappwrite_account_kit

  2. wrap your materialapp flappwriteaccountkit passing 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 flappwriteaccountkit(
    client: client,
    child: materialapp(
    title: ‘flutter demo’,
    theme: themedata(
    primaryswatch: colors.blue,
    ),
    home: mainscreen(),
    ),
    );
    }
    }

  3. access authnotifier from context. authnotifier is an instance of authnotifier that provides all the functions of appwrite’s account service and some easy way to handle authentication.
  4. get context.authnotifier?.status gets the authentication status which can be one of the authstatus.uninitialized, authstatus.unauthenticated, authstatus.authenticating and authstatus.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;
    

    }
    }

  5. you must use the functions from the context.authnotifier instead default account service from appwrite sdk to create user, create session (login), delete session (logout), so that the context.authnotifier?.status is properly updated and your ui updates accordingly.

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.