Types & Models
This page documents the most important public models returned by the Dart/Flutter SDK.
Query models
QueryResponse
Returned by client.query(...).
success: boolresults: List<QueryResult>(one per statement)tookMs: double?error: ErrorDetail?
Convenience helpers:
rows→ first result’sList<Map<String, KalamCellValue>>columns→ first result’sList<SchemaField>
Implementation note: the SDK parses row JSON and keeps schema metadata (SchemaField) so you can build higher-level typed mappers in your app.
QueryResult
columns: List<SchemaField>rows: List<Map<String, KalamCellValue>>rowCount: intmessage: String?
SchemaField
Column metadata includes flag helpers:
isPrimaryKey(flag containspk)isNonNull(flag containsnn)isUnique(flag containsuq)
Authentication models
LoginResponse
Returned by login(...) and refreshToken(...).
accessToken: StringrefreshToken: String?expiresAt: StringrefreshExpiresAt: String?user: LoginUserInfo
expiresAt and refreshExpiresAt are returned as strings (server-provided timestamps). Treat them as opaque unless you control the formatting.
Connection handlers
To receive lifecycle events, pass ConnectionHandlers to KalamClient.connect(...).
Callbacks include:
onConnect()onDisconnect(DisconnectReason reason)onError(ConnectionErrorInfo error)onReceive(String message)onSend(String message)onEvent(ConnectionEvent event)
Lifecycle event types:
ConnectEventDisconnectEventConnectionErrorEventReceiveEvent/SendEvent(debug hooks)
Logging types
The SDK logging API uses Level from package:logger/logger.dart.
KalamLogger.level: LevelKalamLogger.listener: LogListener?LogListener = void Function(LogEntry entry)LogEntryfields:level,message,tag,timestamp
KalamClient.connect(...) also accepts logLevel and logListener so you can configure SDK logs at construction time.
Subscription event types
subscribe(...) returns a Stream<ChangeEvent>.
Event classes:
AckEvent— includessubscriptionId,schema, and snapshot infoInitialDataBatch— initial snapshot rows, potentially in batchesInsertEventUpdateEvent— sparse typed rows pluscolumnIndexesDeleteEventSubscriptionError
All row-bearing events expose typed Map<String, KalamCellValue> rows (for example InsertEvent.row).
For UpdateEvent, those maps are sparse and contain only changed columns plus PK and _seq.
AckEvent and InitialDataBatch include snapshot batching fields (batchNum, hasMore, status).
Subscription management models
SubscriptionInfo
Returned by client.getSubscriptions().
id: String— subscription IDquery: String— SQL querylastSeqId: SeqId?— last received sequence ID (use for resume withfrom)lastEventTimeMs: int?— last event timestamp (millis since epoch)createdAtMs: int— creation timestamp (millis since epoch)closed: bool— whether the subscription is closed
KalamCellValue & typed rows
Every cell in a typed row is a KalamCellValue — a wrapper class with safe
accessor methods that mirrors the Rust KalamCellValue newtype.
import 'package:kalam_link/kalam_link.dart';
final rows = response.rows; // List<Map<String, KalamCellValue>>
for (final row in rows) {
final name = row['name']?.asString(); // String?
final score = row['score']?.asDouble(); // double?
final born = row['created_at']?.asDate(); // DateTime?
final url = row['avatar']?.asFileUrl(
'http://localhost:18080', 'default', 'users',
);
}Use the current helper directly:
final rows = response.rows; // List<Map<String, KalamCellValue>>See Cell Values (KalamCellValue) for the full API including FILE column support and all accessor methods.