Files
stream-chat-flutter/packages/stream_chat_persistence
Reuben TurnerandGitHub b306978da6 chore: apply linter to the various example and test directories (#550)
* chore: remove examples and tests from analysis exclusion

* chore: apply linter fixes to stream_chat_flutter_core/example/main.dart

* chore: apply linter fixes to stream_chat_flutter/example/main.dart

* chore: apply linter fixes to stream_chat_persistence/example/main.dart

* chore: apply linter fixes to stream_chat/example/main.dart

* chore: apply linter fixes to stream_chat_flutter/example/split_view.dart

* chore: renamte tutorial files per linter

* chore: apply linter fixes to tutorial_part_1.dart

* chore: apply linter fixes to tutorial_part_2.dart

* chore: apply linter fixes to tutorial_part_3.dart

* chore: apply linter fixes to tutorial_part_4.dart

* chore: apply linter fixes to tutorial_part_5.dart

* chore: make a widget const in tutorial_part_5.dart

* chore: apply linter fixes to tutorial_part_6.dart

* chore: sort and update dependencies in stream_chat_persistence/example/pubspec.yaml

* chore: sort and update dependencies in stream_chat_flutter_core/example/pubspec.yaml

* chore: sort and update dependencies in stream_chat_flutter/example/pubspec.yaml

* chore: sort dependencies in stream_chat_flutter/example/pubspec.yaml

* chore: apply linter fixes to channel_test.dart

* chore: apply linter fixes to client_test.dart

* chore: apply linter fixes to client_test.dart, stream_http_client_test.dart, and token_manager_test.dart

* chore: apply linter fixes to filter_test.dart

* chore: apply linter fixes to reaction_test.dart

* chore: apply linter fixes to chat_persistence_client_test.dart

* chore: apply linter fixes to channel_image_test.dart

* chore: apply linter fixes to deleted_message_test.dart

* chore: apply linter fixes to full_screen_media_test.dart

* chore: apply linter fixes to gallery_footer_theme_test.dart

* chore: apply linter fixes to gallery_header_theme_test.dart

* chore: apply linter fixes to message_text_test.dart

* chore: apply linter fixes to reaction_bubble_test.dart

* chore: apply linter fixes to system_message_test.dart

* chore: apply linter fixes to typing_indicator_test.dart

* chore: apply linter fixes to channel_list_core_test.dart

* chore: apply linter fixes to channels_bloc_test.dart

* chore: apply linter fixes to lazy_load_scroll_view_test.dart

* chore: apply linter fixes to channel_matcher.dart

* chore: apply linter fixes to message_matcher.dart

* chore: apply linter fixes to users_matcher.dart

* chore: apply linter fixes to message_list_core_test.dart

* chore: apply linter fixes to message_search_bloc_test.dart

* chore: apply linter fixes to message_search_list_core_test.dart

* chore: apply linter fixes to stream_channel_test.dart

* chore: apply linter fixes to stream_chat_core_test.dart

* chore: apply linter fixes to user_list_core_test.dart

* chore: apply linter fixes to channel_query_dao_test.dart, message_mapper_test.dart, user_mapper_test.dart, and users_bloc_test.dart

* chore: apply some missed dartfmt

* test: regenerate failinggolden test
2021-07-16 10:49:51 +02:00
..
2021-07-06 17:35:48 +02:00
2021-04-07 12:24:29 +02:00
2021-07-07 17:39:55 +02:00
2021-01-29 20:22:04 +05:30
2021-07-07 17:39:55 +02:00
2021-04-01 15:34:43 +02:00

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.background,
);
  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.