hexabase 0.4.2 copy "hexabase: ^0.4.2" to clipboard
hexabase: ^0.4.2 copied to clipboard

Dart and Flutter SDK for Hexabase

Hexabase SDK for Dart and Flutter #

Usage #

Import #

import 'package:hexabase/hexabase.dart';

Initializing #

Hexabase();

After initialized the client, you can take client object anytime.

var client = Hexabase.instance;

Log in #

await client.auth.login('you@example.com', 'your_secure_password');

Workspace #

Get all workspaces

var workspaces = await client.workspace.all();
// workspaces[0].id
// workspaces[0].name

Get workspace

var workspace = client.workspace(id: 'WORKSPACE_ID');

Application #

Get all applications

var applications = await workspace.applications();
print(applications[0].id);
print(applications[0].datastores[0].id);

Get application

var application = client.application(id: 'APPLICATION_ID');

Create application

var application = client.application();
application.name = {
	HBAppName.ja: 'テストアプリ',
	HBAppName.en: 'Test App',
};
await application.save();

Update application

var application = client.application(id: 'APPLICATION_ID');
application.name[HBAppName.en] = 'Test app v2';
await application.save();

Delete application

await application.delete();

Datastore #

Get datastore

var application = client.application(id: 'APPLICATION_ID');
var datastore = application.datastore(id: 'DATASTORE_ID');

Datastore Item #

Search datastore items

var query.= datastore.query.);
query.equalTo('name', 'value');
var items = await datastore.items(query.;

Create new item

var item = datastore.item();
item.set('name', 'value').set('price', 100);
await item.save();

Update item

item.set('price', 110).set('salesDate', DateTime.now());
await item.save();

Update item status

item
	.action('startReservation') // Action ID or Action Id or Action name (English) or Action name (Japanese)
	.set('salesDate', DateTime.now()); // You can also update other fields
await item.save();

Delete item

await item.delete();

Search conditions #

Equal to

var query.= datastore.query();
query.equalTo('name', 'value');

Not equal to

query.notEqualTo("name", "value");

Greater than ">"

Only support int and DateTime.

query.greaterThan("price", 100);

Greater than or equal ">="

Only support int and DateTime.

query.greaterThanOrEqualTo("price", 100);

Less than "<"

Only support int and DateTime.

query.lessThan("price", 100);

Less than or equal "<="

Only support int and DateTime.

query.lessThanOrEqualTo("price", 100);

In

// name == "Apple" or name == "Orange"
query.inArray("name", ["Apple", "Orange"]);

Not in

// name != "Apple" && name != "Orange"
query.notInArray("name", ["Apple", "Orange"]);

License #

MIT License

2
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Dart and Flutter SDK for Hexabase

Homepage

License

unknown (LICENSE)

Dependencies

collection, flutter, graphql, tuple

More

Packages that depend on hexabase