Skip to Content

Types & Models

This page documents the most important public models returned by the Dart/Flutter SDK.

Query models

QueryResponse

Returned by client.query(...).

  • success: bool
  • results: List<QueryResult> (one per statement)
  • tookMs: double?
  • error: ErrorDetail?

Convenience helpers:

  • rows → first result’s parsed List<List<dynamic>>
  • columns → first result’s List<SchemaField>
  • toMaps() → first result’s List<Map<String, dynamic>>

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<List<dynamic>> (parsed from JSON)
  • rowCount: int
  • message: String?
  • toMaps(): List<Map<String, dynamic>>

SchemaField

Column metadata includes flag helpers:

  • isPrimaryKey (flag contains pk)
  • isNonNull (flag contains nn)
  • isUnique (flag contains uq)

Authentication models

LoginResponse

Returned by login(...) and refreshToken(...).

  • accessToken: String
  • refreshToken: String?
  • expiresAt: String
  • refreshExpiresAt: 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:

  • ConnectEvent
  • DisconnectEvent
  • ConnectionErrorEvent
  • ReceiveEvent / SendEvent (debug hooks)

Subscription event types

subscribe(...) returns a Stream<ChangeEvent>.

Event classes:

  • AckEvent — includes subscriptionId, schema, and snapshot info
  • InitialDataBatch — initial snapshot rows, potentially in batches
  • InsertEvent
  • UpdateEvent
  • DeleteEvent
  • SubscriptionError

All row-bearing events expose parsed JSON maps (for example InsertEvent.row).

AckEvent and InitialDataBatch include snapshot batching fields (batchNum, hasMore, status).

Next

Last updated on