appwrite_dart_wrapper 0.6.1 copy "appwrite_dart_wrapper: ^0.6.1" to clipboard
appwrite_dart_wrapper: ^0.6.1 copied to clipboard

Function Wrapper for dart_appwrite, with error handling and dependency injection.

example/appwrite_dart_wrapper_example.dart

import 'package:appwrite_dart_wrapper/appwrite_dart_wrapper.dart';
import 'package:dart_appwrite/dart_appwrite.dart';
import 'package:dart_appwrite/src/client.dart';

Future<void> main() async {
  await start(
      Req(variables: {
        "APPWRITE_FUNCTION_ENDPOINT": "https://api.appwrite.io",
        "APPWRITE_FUNCTION_PROJECT_ID": "your project id",
        "APPWRITE_FUNCTION_API_KEY": "your project key"
      }), Res(onData: (awesome, s) {
    print("awsome: $awesome");
  }));
}

Future<void> start(final req, final res) async => await startWrapper(
      req,
      res,
      biz,
      log: true,
      debug: true, // default set false
      debugUserId: 'your-appwrite.io-user-id or null',
    );

Future<Result> biz(
  Map<String, dynamic> headers,
  Map<String, dynamic> payload,
  Map<String, String> vars,
  Client client,
) async {
//   final fnCeateDoc = buildFnCreateRecord(
//     client,
//     databaseId: '<your-db-id>',
//     collectionId: '<your-doc-collection-id>',
//   );

// // use
//   await fnCeateDoc(documentId: ID.unique(), data: {
//     "name": 'test1',
//     "age": 123,
//   });

//  test error report
//   throw "hahaha";
  return Result.rOk(msg: 'Yes Awesome, payloads $payload, vars $vars');
}
1
likes
120
pub points
0%
popularity

Publisher

unverified uploader

Function Wrapper for dart_appwrite, with error handling and dependency injection.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

dart_appwrite, get_it

More

Packages that depend on appwrite_dart_wrapper