Skip to main content

postgrest 3.0.0-dev.15 copy "postgrest: ^3.0.0-dev.15" to clipboard
postgrest: ^3.0.0-dev.15 copied to clipboard

PostgREST client for Dart. This library provides an ORM interface to PostgREST.

example/main.dart

// The typed table API is still experimental.
// ignore_for_file: experimental_member_use

import 'package:postgrest/postgrest.dart';

import 'supabase_schema.g.dart';

/// Example to use with Supabase API https://supabase.com/
dynamic main() async {
  const supabaseUrl = '';
  const supabaseKey = '';
  final client = PostgrestClient(
    '$supabaseUrl/rest/v1',
    headers: {'apikey': supabaseKey},
    schema: 'public',
  );
  try {
    // `Countries` is generated from the database schema with
    // `supabase gen types --lang dart`, so the rows are typed.
    final countries = await client
        .table(Countries.table)
        .select()
        .where(Countries.name.ilike('s%'))
        .order(Countries.name);
    for (final country in countries) {
      print('${country.id}: ${country.name}');
    }
  } on PostgrestApiException catch (error) {
    // handle PostgrestError
    print(error.errorCode);
    print(error.message);
  }
}
137
likes
0
points
1.26M
downloads

Documentation

Documentation

Publisher

verified publishersupabase.io

Weekly Downloads

PostgREST client for Dart. This library provides an ORM interface to PostgREST.

Homepage
Repository (GitHub)
View/report issues

Topics

#supabase #postgrest #database #orm #api

License

unknown (license)

Dependencies

crypto, http, logging, meta, supabase_common, yet_another_json_isolate

More

Packages that depend on postgrest