Skip to content

About

Shipbook Flutter SDK: remote logging for Flutter apps. Send logs, errors and exceptions to the cloud.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

58 Commits

Folders and files

Repository files navigation

Shipbook Flutter SDK

pub package

Shipbook SDK for Flutter applications. Capture logs, errors, and exceptions from your Flutter apps and view them in the Shipbook console. Learn more at shipbook.io.

Installation

Add to your pubspec.yaml:

dependencies:
  shipbook_flutter: ^2.1.0

Then run:

flutter pub get

Quick Start

import 'package:shipbook_flutter/shipbook_flutter.dart';
import 'package:shipbook_flutter/log.dart';

void main() {
  runApp(const MyApp());

  // Initialize Shipbook (do this once at app startup, after runApp)
  Shipbook.start('YOUR_APP_ID', 'YOUR_APP_KEY');
}

// Get a logger for your class/component
final log = Shipbook.getLogger('MyWidget');

// Log messages at different severity levels
log.v('Detailed trace information');
log.d('Debug information');
log.i('General information');
log.w('Warning message');
log.e('Error message');

// Log a caught error or exception with its stack trace
try {
  await api.checkout(cart);
} catch (error, stackTrace) {
  log.e('Checkout failed', error, stackTrace);
}

Features

  • Remote Logging - View all your app logs in the Shipbook console
  • Error Tracking - Automatically captures uncaught exceptions and Flutter errors
  • Session Tracking - Group logs by user session
  • Offline Support - Logs are queued and sent when connectivity is restored
  • Dynamic Configuration - Change log levels remotely without redeploying
  • User Identification - Associate logs with specific users

Configuration

Enable Inner Logging (Debug Mode)

Shipbook.enableInnerLog(true);

Register User

Shipbook.registerUser(
  'user-123',
  userName: 'johndoe',
  fullName: 'John Doe',
  email: 'john@example.com',
  phoneNumber: '+1234567890',
  additionalInfo: {'role': 'admin'},
);

Logout

Shipbook.logout();

Link Sessions with Your Backend

Add the session headers to requests toward your own backend, and the Shipbook console links this app session to the sessions those requests create in your Node.js backend:

await http.post(
  Uri.parse('https://api.your-backend.com/checkout'),
  headers: {'Content-Type': 'application/json', ...Shipbook.getSessionHeaders()},
  body: jsonEncode(cart),
);

It returns an empty map until login completes, so spreading it is always safe.

Screen Tracking

Shipbook.screen('HomePage');

Static Log Methods

You can also use static methods without creating a logger instance. The tag is automatically inferred from the caller's file name:

Log.error('Something went wrong');
Log.warning('This is a warning');
Log.info('General info');
Log.debug('Debug info');
Log.verbose('Trace info');

Getting Your App ID and Key

  1. Sign up at shipbook.io
  2. Create a new application in the console
  3. Copy your App ID and App Key from the application settings

For full setup instructions, see the Flutter documentation.

Links

Author

Elisha Sterngold (ShipBook Ltd.)

License

ShipBook SDK is available under the MIT license. See the LICENSE file for more info.

About

Shipbook Flutter SDK: remote logging for Flutter apps. Send logs, errors and exceptions to the cloud.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages