Shorebase Flutter SDK

Official Flutter SDK for Shorebase—the application platform that ships identity, configuration, and customer experience tools so you can build, manage, and scale apps faster.

Platform capabilities

  • Identity: identify users, manage sessions, and keep auth tokens synced.
  • Configuration: feature flags and typed remote config without redeploying your app.
  • Support: ticketing and messaging APIs with streams for reactive UI.
  • UI kit: drop-in widgets (TicketListView, ChatView) to ship support instantly.
  • Built on Dio with pluggable storage and lightweight defaults.

Installation

dependencies:
  shorebase: ^0.1.2

Quick start

Initialize once at app startup with your public API key and workspace URL.

import 'package:shorebase/shorebase.dart';
import 'package:flutter/widgets.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  Shorebase.initialize(
    baseUrl: 'https://api.shorebase.com',
    apiKey: 'YOUR_PUBLIC_API_KEY',
  );

  runApp(const MyApp());
}

Identify the user

Call after login (or with a device identifier for anonymous sessions).

await Shorebase.instance.identify(
  externalId: 'user_123',
  email: 'user@example.com',
  name: 'Taylor Camp',
  isPremium: true,
  customData: {'plan': 'pro'},
  // deviceModel is auto captured; override if you already know it:
  // deviceModel: 'iPhone 17.1',
);

Anonymous bootstrap

Prefer identifyAnonymous when you don't have a signed-in user yet. It stores a stable SBAnonymous:<hash> identifier on device and forwards the device model to the API.

await Shorebase.instance.identifyAnonymous();
// Later on login
final anonymousId = await Shorebase.instance.getOrCreateAnonymousId();
await Shorebase.instance.identify(
  externalId: 'real-user-123',
  previousId: anonymousId,
);

Remote configuration

final config = await Shorebase.instance.getConfig('welcome_message');
debugPrint('Value: ${config.value}');

Support APIs

final tickets = await Shorebase.instance.getTickets();
final newTicket = await Shorebase.instance.createTicket(
  subject: 'App crashing on settings',
  content: 'Happens when toggling notifications.',
);

Shorebase.instance.watchTicket(newTicket.id).listen((ticket) {
  debugPrint('Latest messages: ${ticket.messages}');
});

Drop-in UI

Navigator.push(context, MaterialPageRoute(builder: (_) {
  return TicketListView(
    client: Shorebase.instance,
    onTicketTap: (ticket) => Navigator.push(context, MaterialPageRoute(
      builder: (_) => ChatView(
        client: Shorebase.instance,
        ticketId: ticket.id,
        subject: ticket.subject,
      ),
    )),
  );
}));

Additional resources

Libraries

shorebase