bicho19 / feather-client-flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flutter Feather Client Plugin

A Flutter plugin to use the Feather API.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

Have any questions? Join Feather Discord 👋

Available Features

Feature Status
Create a credential (Email and password)
Create a credential (Email verification - passwordless -) ⚙️
Update a credential ⚙️
Update a credential password ⚙️
Creates a user
Retrieve a user ⚙️
Update a user ⚙️
Update a user's email ⚙️
Refresh a user's tokens ⚙️
Revoke a user's tokens ⚙️
  • ✅ Done
  • ⚙️ Under development

Getting Started

dependencies:
  ...
  feather_client_flutter: 

Usage example

The Feather plugin must be initialized with your project's API key, available on the Feather Dashboard.

Add the following imports to your Dart code:

import 'package:feather_client_flutter/feather_client_flutter.dart';

Initialize FeatherClient :

FeatherClient featherClient = FeatherClient(apiKey: "YOUR_API_KEY");

To sign in:

featherClient
        .newCurrentCredential(email: "test5@test.com", password: "password")
        .then((credential) {
          if (credential.status == "valid") {
            featherClient.newCurrentUser(token: credential.token).then((featherUser) {
              print("User id : ${featherUser.id}");
            }).catchError((error) {
              // Handle errors
              print(error.toString());
            }
          } 
        );
        }).catchError((error) {
          // Handle errors
          print(error.toString());
    });

Error handling

If a method fails it will throw a FeatherException with the error code as a string. So make sure to wrap your calls with a try..catch or add a .catchError functions. Check the source comments to see which error codes each method could throw.

Supported authentication methods

  • Email and Password
  • Anonymously (To be added later)

About

License:Other


Languages

Language:Dart 100.0%