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

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

Official Chat Persistence Client for Stream Chat #

The official Chat Persistence Client for Stream Chat, a service for building chat applications.

Pub CI

Quick Links

This package provides a persistence client for fetching and saving chat data locally. Stream Chat Persistence uses Moor as a disk cache.

Changelog #

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

Add dependency #

Add this to your package's pubspec.yaml file, use the latest version Pub

dependencies:
 stream_chat_persistence: ^latest_version

You should then run flutter packages get

Usage #

The usage is pretty simple.

  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 official Stream chat client.
  final client = StreamChatClient(
    apiKey ?? kDefaultStreamApiKey,
    logLevel: Level.INFO,
  )..chatPersistenceClient = chatPersistentClient;

And you are ready to go...

Flutter Web #

Due to Moor web (for offline storage) you need to include the sql.js library:

<!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 here 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. We are pleased to merge your code into the official repository. Make sure to sign our Contributor License Agreement (CLA) first. See our license file for more details.

19
likes
110
points
5.31k
downloads

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

Documentation

API reference

License

unknown (license)

Dependencies

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

More

Packages that depend on stream_chat_persistence