Prisma Client Dart Documentation

repository·main·Indexed 19 days ago

https://github.com/medz/dart-orm

An auto-generated, type-safe ORM for Dart applications that leverages the Prisma Engine for data access. It provides an API experience consistent with the Prisma Client for JavaScript and TypeScript, supporting Dart Native, Dart Web, Flutter Native, and Flutter Web via Binary, Library, or Data Proxy engines.

Tokens
371
Snippets
2
Records
3
Agent score
17%

What's inside Prisma Client Dart

  1. Quickstart: Using PrismaClient in Dart

    main

    Prisma Client Dart is an auto-generated type-safe ORM that uses the Prisma Engine as its data access layer. It aims for API consistency with the Prisma Client JS/TS implementations.

    To use it, import the orm package, instantiate PrismaClient, and call generated methods on the client instance to perform database operations.

    import 'package:orm/orm.dart';
    
    final client = PrismaClient();
    
    main() async {
      final users = await client.user.findMany();
    }
  2. Install Prisma Client Dart

    main

    To add Prisma Client Dart to your Dart project, you can either manually update your pubspec.yaml file or use the Dart CLI.

    Option 1: Manual update

    Add orm to your dependencies in pubspec.yaml:

    dependencies:
      orm: latest

    Option 2: Using Dart CLI

    Run the following command in your terminal:

    dart pub add orm
  3. Query engine support matrix

    main

    The availability of Prisma engines depends on your target platform. Use the following matrix to determine compatibility for your environment:

    EngineDart NativeDart WebFlutter NativeFlutter Web
    Binary
    Library
    Data Proxy