etebase_flutter

CI/CD for etebase_flutter Pub Version

Flutter platform plugins for the dart bindings of libetebase.

Table of contents

Table of contents generated with markdown-toc

Features

  • Flutter plugin extension of the etebase package.
  • Comes with bundled libraries for Android, iOS, macOS, Windows
    • Linux is also supported, via pkg-config
  • Automatically initializes etebase with flutter.

Installation

Simply add etebase_flutter to your pubspec.yaml and run dart pub get (or flutter pub get).

dart pub add etebase_flutter

Note: Pure Dart users should use the etebase package instead.

Usage

Library initialization

To initialize the library, you don't really need to do anything, as the library is automatically initialized via WidgetsFlutterBinding.ensureInitialized().

However, you need to create and manage a EtebaseClient instance. My recommendation here is to use a dependency injection, for example riverpod to manage the client:

final etebaseClientProvider = FutureProvider(
  (ref) => EtebaseClient.create('my-client'),
);

// ...

Widget build(BuildContext context, WidgetRef ref) =>
  ref.watch(etebaseClientProvider).when(
    loading: () => const CircularProgressIndicator(),
    error: (err, stack) => Text('Error: $err'),
    data: (client) {
      return Text("Client is ready!");
    },
  );

For all other information regarding the usage of the library, refer to the etebase package.

Linux Platform setup

When working with linux, you can optionally decide to use pkg-config for resolving libetebase instead of using the bundled library. This will cause the linux build to link against the system library instead of the embedded one, providing it is installed.

To enable this mode, simply set the LIBETEBASE_USE_PKGCONFIG environment variable to anything but an empty value before compiling. Example:

export LIBETEBASE_USE_PKGCONFIG=1
flutter clean # recommended to ensure no build artifacts are cached
flutter build linux

Documentation

The documentation is available at https://pub-web.flutter-io.cn/documentation/etebase_flutter/latest/. A basic example can be found at https://pub-web.flutter-io.cn/packages/etebase_flutter/example. Also, the etebase package itself has additional documentation for general use of the API.

In addition to that, you can and should refer to the official Etebase Documentation. As the API tries to recreate the Rust-API as closely as possible, you can refer to the Rust examples in that documentation. Most of the samples there can be easily applied to the dart code.

Libraries

etebase_flutter