edgebase_core 0.1.2
edgebase_core: ^0.1.2 copied to clipboard
EdgeBase Core SDK — shared types, HTTP client, and table/storage operations.
edgebase_core
Low-level Dart primitives for EdgeBase
HTTP client, query builder, storage, field ops, generated API bindings, and shared error types
Dart VM · Package authors · Custom integrations · SDK internals
Client SDK Docs · Admin SDK Docs · Storage Docs · Quickstart
edgebase_core is the low-level Dart foundation for EdgeBase SDKs.
It powers packages like edgebase_flutter and edgebase_admin, and it is useful when you want:
- direct access to the low-level
HttpClient - generated API wrappers without the higher-level SDK layers
- table and document references for custom integrations
- storage primitives
- field operations like
increment()anddeleteField() - shared EdgeBase error types
If you are building a normal Flutter app, start with edgebase_flutter. If you need trusted Service Key access on the server, start with edgebase_admin.
Documentation Map #
- Database Client SDK Higher-level query patterns built on top of this package
- Database Admin SDK Trusted server-side usage patterns
- Storage Docs Bucket operations, URLs, signed URLs, and uploads
- Quickstart Full project setup with EdgeBase
For AI Coding Assistants #
If you are using an AI coding assistant, check llms.txt before generating code.
It captures the low-level package boundary, canonical examples, and Dart-specific rules for DbRef, TableRef, batch operations, and storage signed URL semantics.
Installation #
dart pub add edgebase_core
Why This Package Exists #
Most apps should not start with edgebase_core.
This package exists so you can build on the same low-level pieces the higher-level SDKs use:
| Capability | Included |
|---|---|
| HTTP client | HttpClient |
| Generated API wrappers | GeneratedDbApi |
| Database references | DbRef, TableRef, DocRef |
| Storage | StorageClient |
| Field operations | increment(), deleteField() |
| Context handling | ContextManager |
| Error types | EdgeBaseError, FieldError |
| Token contracts | TokenManager, TokenPair |
Quick Start #
import 'package:edgebase_core/edgebase_core.dart';
final httpClient = HttpClient(
baseUrl: 'https://your-project.edgebase.fun',
contextManager: ContextManager(),
);
final api = GeneratedDbApi(httpClient);
final posts = DbRef(api, 'app').table('posts');
final result = await posts
.where('published', '==', true)
.limit(10)
.getList();
print(result.items);
Working With Tables #
final posts = DbRef(api, 'app').table('posts');
final created = await posts.insert({
'title': 'Hello EdgeBase',
'published': true,
});
final updated = await posts.doc(created['id'] as String).update({
'title': 'Updated title',
});
print(updated);
For instance databases, pass the instance id to DbRef:
final workspacePosts = DbRef(api, 'workspace', instanceId: 'ws-123')
.table('posts');
Storage #
final storage = StorageClient(httpClient);
await storage.upload(
'uploads',
'hello.bin',
[1, 2, 3, 4],
contentType: 'application/octet-stream',
);
final url = storage.getUrl('uploads', 'hello.bin');
print(url);
Read more: Storage Docs
Field Operations #
Use the helper operations when you need atomic updates:
await posts.doc('post-123').update({
'viewCount': increment(1),
'legacyField': deleteField(),
});
Error Handling #
try {
await posts.getOne('missing-id');
} on EdgeBaseError catch (error) {
print(error.message);
print(error.statusCode);
}
Building On Top Of edgebase_core #
HttpClient accepts:
baseUrlcontextManager- optional
tokenManager - optional
serviceKey
That makes it flexible enough for:
- custom SDK wrappers
- internal tooling
- server-side scripts
- partial integrations where you do not want the full Flutter or admin surface
Choose The Right Dart Package #
| Package | Use it for |
|---|---|
edgebase_flutter |
Flutter apps and client-side flows |
edgebase_admin |
Trusted server-side Dart code with Service Key access |
edgebase_core |
Low-level building blocks and custom integrations |
edgebase |
Umbrella package when you want a broader Dart entry point |
License #
MIT