Skip to main content
Configuration class for initializing the Kuralit Flutter SDK.

Class

class
KuralitConfig
Configuration for the Kuralit SDK.

Constructor

constructor
KuralitConfig()
Create a new KuralitConfig instance.

Parameters

serverUrl
String
required
WebSocket server URL (e.g., “wss://api.kuralit.com/ws”).
apiKey
String
required
API key for authentication.
appId
String
required
Application identifier.
debug
bool
default:"false"
Enable debug logging.
reconnectEnabled
bool
default:"true"
Enable automatic reconnection.
maxReconnectAttempts
int
default:"10"
Maximum number of reconnection attempts.
reconnectDelayMs
int
default:"1000"
Initial reconnect delay in milliseconds.
heartbeatIntervalMs
int
default:"30000"
Heartbeat interval in milliseconds (0 to disable).

Factory Constructors

defaults()

defaults
KuralitConfig
Create a config with default settings.Parameters:
  • serverUrl (String, required)
  • apiKey (String, required)
  • appId (String, required)
  • debug (bool, default: false)
Example:
final config = KuralitConfig.defaults(
  serverUrl: 'ws://localhost:8000/ws',
  apiKey: 'demo-key',
  appId: 'my-app',
);

production()

production
KuralitConfig
Create a config optimized for production.Parameters:
  • serverUrl (String, required)
  • apiKey (String, required)
  • appId (String, required)
Settings:
  • debug: false
  • reconnectEnabled: true
  • maxReconnectAttempts: 10
  • heartbeatIntervalMs: 30000
Example:
final config = KuralitConfig.production(
  serverUrl: 'wss://api.example.com/ws',
  apiKey: 'prod-key',
  appId: 'my-app',
);

development()

development
KuralitConfig
Create a config optimized for development.Parameters:
  • serverUrl (String, required)
  • apiKey (String, required)
  • appId (String, required)
Settings:
  • debug: true
  • reconnectEnabled: true
  • maxReconnectAttempts: 5
  • heartbeatIntervalMs: 15000
Example:
final config = KuralitConfig.development(
  serverUrl: 'ws://localhost:8000/ws',
  apiKey: 'dev-key',
  appId: 'my-app',
);

Usage Examples

Basic Configuration

final config = KuralitConfig(
  serverUrl: 'ws://localhost:8000/ws',
  apiKey: 'demo-api-key',
  appId: 'my-app',
  debug: true,
);

Kuralit.init(config);

Production Configuration

final config = KuralitConfig.production(
  serverUrl: 'wss://api.example.com/ws',
  apiKey: 'prod-api-key',
  appId: 'my-app',
);

Kuralit.init(config);

Custom Reconnection Settings

final config = KuralitConfig(
  serverUrl: 'ws://localhost:8000/ws',
  apiKey: 'demo-api-key',
  appId: 'my-app',
  reconnectEnabled: true,
  maxReconnectAttempts: 5,
  reconnectDelayMs: 2000,
  heartbeatIntervalMs: 30000,
);

Kuralit.init(config);