noverachat_flutter 0.6.1
noverachat_flutter: ^0.6.1 copied to clipboard
Flutter bindings for NoveraChat — lifecycle-managed providers and controllers over the headless noverachat_dart core.
English | 한국어
noverachat_flutter #
Flutter bindings for NoveraChat. The chat logic lives in noverachat_dart (the headless NoveraChat / Room core); this is the thin layer that wires it into Flutter — a client provider + ChangeNotifier controllers that turn the core's Streams into UI state + builder widgets.
Tip: inject a
cacheStoreinClientOptionsandRoomController/RoomListControllerrender the last known history and room list instantly on cold start (snapshot cache) — zero screen-code changes.
What it is (and isn't) #
A lifecycle + state-binding layer, nothing more.
- It does not reimplement chat logic — that's
noverachat_dart. - It does not ship chat UI —
ChatMessageis data; render it with your own widgets. - It does turn the core's
Streams into rebuildable Flutter state (providers +ChangeNotifiercontrollers) and manageconnect()/disconnect()over the widget lifecycle.
The barrel re-exports noverachat_dart, so a single import 'package:noverachat_flutter/noverachat_flutter.dart'; gives you ClientOptions, NoveraChat, Room and the bindings together.
Usage #
// Provide a connected client to the subtree; disconnects on dispose.
NoveraChatScope(
options: ClientOptions(
appId: 'app_9f8k2x',
endpoint: 'https://chat.example.com',
tokenProvider: () async => fetchJwtFromYourServer(),
),
child: const ChatScreen(roomId: 'room_123'),
);
// Inside the subtree — build a controller once (e.g. in didChangeDependencies):
final chat = NoveraChatScope.of(context);
final room = RoomController(chat.room('room_123'))..loadHistory();
// Rebuild a list as messages arrive:
MessagesBuilder(
controller: room,
builder: (context, messages) => MyMessageList(messages),
);
room.send('hello'); // optimistic — shows immediately, reconciles on ack
Bindings #
| Binding | Wraps | Role |
|---|---|---|
NoveraChatScope |
NoveraChat |
InheritedWidget; owns the client, runs connect/disconnect over the widget lifecycle; NoveraChatScope.of(context) reads it |
ChatMessage |
— | Uniform view model over the SDK's history / live / optimistic message shapes |
RoomController |
Room |
ChangeNotifier over the core MessageCollection — the message list, optimistic send / markRead and cache hydration live in the core; this bridges its change events to rebuilds and flushes reads on background |
MessagesBuilder |
RoomController |
Widget that rebuilds as the message list changes |
TypingController |
Room.onTyping |
Who-is-typing state (auto-expires per user) |
UnreadController |
NoveraChat.unreadSummary |
Unread badge state |
RoomListController |
NoveraChat.unreadSummary + WS streams |
Chat-tab room list — live previews, unread badges, most-recently-active ordering |
Documentation #
Flutter-specific guides are on the NoveraChat docs site (source under doc/) — start with build a chat screen.
| Section | Contents |
|---|---|
| Getting started | Install + wire a chat screen |
| Guides | State & lifecycle · chat-room list · room settings · files & media · read receipts · reactions & replies |
| Reference | Bindings API |
Chat behavior — auth, connection, messaging, rooms, push, errors — is documented in noverachat_dart, not duplicated here.
For contributors #
| Doc | Contents |
|---|---|
| doc/internal/architecture | Patterns, lifecycle, design decisions, invariants |
| doc/internal/structure | File map — what lives where |
Example #
A runnable one-screen chat is in example/. See its README for how to run it (flutter create . + --dart-define for config).
The dependency on noverachat_dart is wired in pubspec.yaml (path: ../sdk-dart).