pocketbase 0.1.0+1 copy "pocketbase: ^0.1.0+1" to clipboard
pocketbase: ^0.1.0+1 copied to clipboard

Multi-platform Dart SDK for PocketBase, an open source realtime backend in 1 file.

example/example.dart

// ignore_for_file: unnecessary_lambdas

import "dart:async";

import "package:pocketbase/pocketbase.dart";

void main() {
  final client = PocketBase("http://localhost:8090");

  // fetch a paginated list with "example" records
  client.records.getList("example", page: 1, perPage: 50).then((result) {
    // success...
    print("Result: $result");
  }).catchError((dynamic error) {
    // error...
    print("Error: $error");
  });

  // subscribe to realtime changes in the "example" collection
  client.realtime.subscribe("example", (e) {
    print(e.action); // create, update, delete
    print(e.record); // the changed record
  });

  // unsubsribe from all realtime subscriptions after 10 seconds
  Timer(const Duration(seconds: 10), () {
    client.realtime.unsubscribe();
  });
}
186
likes
0
pub points
93%
popularity

Publisher

verified publisherpocketbase.io

Multi-platform Dart SDK for PocketBase, an open source realtime backend in 1 file.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http, json_annotation

More

Packages that depend on pocketbase