Skip to content
pubscout

mock_supabase_http_client

0.1.0, released 2 months ago by supabase.io

A mock Supabase client for unit testing API calls without network requests.

WASM-ready
$ flutter pub add mock_supabase_http_client
Source repository

What it does

Intercepts HTTP requests for Supabase clients and stores mock data in memory. Supports select, insert, update, upsert, delete, filtering, ordering, limiting, edge functions, and RPC calls.

AI-written summary of version 0.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to unit test Supabase API calls in your Flutter or Dart app
  • You want to mock Supabase tables, edge functions, and RPC calls without real network connections

Skip it when

  • You need full support for auth, realtime, or storage mocks
  • You need nested referenced table data or !inner joins

Strengths

  • Allows testing database operations and filtering easily in memory
  • Supports custom edge function handlers and mock RPC functions
  • Provides error trigger callbacks to simulate postgrest exceptions

Weaknesses

  • Discontinued in favor of supabase_test once supabase_flutter v3 is released
  • Does not support nested referenced table data or table schemas
  • Does not support auth, realtime, or storage

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2

Add to dev_dependencies and pass the mock HTTP client to your SupabaseClient.

import 'package:mock_supabase_http_client/mock_supabase_http_client.dart';
import 'package:supabase/supabase.dart';

final mockSupabase = SupabaseClient(
  'https://mock.supabase.co',
  'fakeAnonKey',
  httpClient: MockSupabaseHttpClient(),
);

Alternatives

Packages that do the same job and could replace mock_supabase_http_client.

  • autopilot

    A test driver for Flutter that exposes a JSON HTTP API for QA testing.

  • charlatan

    Configure and provide fake HTTP responses to the dio HTTP client for testing.

  • nock

    HTTP requests mocking library for Dart and Flutter.

Works with

Packages commonly used together with mock_supabase_http_client: ones it builds on, ones built on it, and its own family.