stream_chat_persistence 10.0.1 copy "stream_chat_persistence: ^10.0.1" to clipboard
stream_chat_persistence: ^10.0.1 copied to clipboard

Official Stream Chat Persistence library. Build your own chat experience using Dart and Flutter.

Official Persistence Client for Stream Chat #

The official persistence client for Stream Chat, a service for building chat applications.

Pub CI

Quick Links

Changelog #

Check out the changelog on pub.dev to see the latest changes in the package.

Overview #

This package provides a persistence client for fetching and saving chat data locally. It is powered by Drift (SQLite) and plugs into any of the Stream Chat Flutter packages to add offline storage and optimistic UI updates.

Add Dependency #

Add this to your pubspec.yaml, using the latest version Pub:

dependencies:
  stream_chat_persistence: ^10.0.0

Then run:

flutter pub get

Usage #

  1. Create a new instance of StreamChatPersistenceClient, providing logLevel and connectionMode:
final chatPersistentClient = StreamChatPersistenceClient(
  logLevel: Level.INFO,
  connectionMode: ConnectionMode.regular,
);
  1. Pass the instance to the StreamChatClient:
final client = StreamChatClient(
  apiKey,
  logLevel: Level.INFO,
)..chatPersistenceClient = chatPersistentClient;

And you are ready to go.

Flutter Web #

Due to Drift's web backend you need to include the sql.js library. Add the following to your web/index.html:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script defer src="sql-wasm.js"></script>
    <script defer src="main.dart.js" type="application/javascript"></script>
</head>
<body></body>
</html>

You can grab the latest version of sql-wasm.js and sql-wasm.wasm from the sql.js releases and copy them into your /web folder.

Contributing #

We welcome code changes that improve this library or fix a problem. Please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on GitHub. Make sure to sign our Contributor License Agreement (CLA) first. See our license file for more details.

20
likes
140
points
23.7k
downloads

Documentation

API reference

Publisher

verified publishergetstream.io

Weekly Downloads

Official Stream Chat Persistence library. Build your own chat experience using Dart and Flutter.

Repository (GitHub)
View/report issues
Contributing

License

unknown (license)

Dependencies

drift, flutter, logging, meta, path, path_provider, sqlite3_flutter_libs, stream_chat

More

Packages that depend on stream_chat_persistence