sdk-for-flutter icon indicating copy to clipboard operation
sdk-for-flutter copied to clipboard

🚀 Feature: Improve API syntax

Open superakabo opened this issue 2 years ago • 0 comments

🔖 Feature description

The APIs for Appwrite can be improved, made less verbose and more Dart/Flutter friendly by adopting a declarative approach in many scenarios. Also, since majority of Appwriters might have experience with Firebase, I think it will be best to create similar APIs or better. I think the experience will be better if developers for example, do not have to create instances of Client, Users, Database, Storage etc. objects first.

🎤 Pitch

Instead of

Client client = Client();
client
    .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
    .setProject('5e8cf4f46b5e8') // Your project ID
    .setSelfSigned(); // Use only on dev mode with a self-signed SSL cert

It can be

Appwrite.instance.initialize(
   endpoint: 'https://localhost/v1',
   propjectId:'5e8cf4f46b5e8',
   selfSigned: true,
);

Instead of

Users users = Users(client);
Future result = users.create(
    userId: '[USER_ID]',
    email: '[email protected]',
    password: 'password',
    name: 'My Name'
 );

It can be

Appwrite.instance.createUser(
    userId: '[USER_ID]',
    email: '[email protected]',
    password: 'password',
    name: 'My Name'
);

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

superakabo avatar Sep 21 '22 14:09 superakabo