Flutter
Flutter bridge over the native Android and iOS chat SDKs; the native chat screen is presented, so there is no Dart-side UI to compose. Flutter 3.3+, iOS 14+, Android minSdk 24 with JDK 17 and mavenCentral() in your Gradle repositories.
Install and quick startlink
flutter pub add newinstance_chatfinal chat = NewinstanceChat(NewinstanceChatConfig(apiKey: 'sk_live_abc123'));
await chat.ready;
await chat.setUser(ChatUser(customerName: 'Ada', customerEmail: 'ada@example.com'));
await chat.initialize();
await chat.openChat();NewinstanceChatConfig(apiKey, baseUrl?, transport?, initialMessage?); the baseUrl override is honoured by debug builds only. ChatUser(customerName required, customerEmail?, customerId?). ready resolves once native configuration completes.
API and eventslink
Methods: setUser, initialize, openChat, closeChat, sendMessage, retryMessage, attachFile(AttachmentInput(uri, name, mimeType)), destroy. Handoff, typing and attachment removal are driven by the native screen, not the Dart surface.
Streams: onMessageReceived, onMessageSent, onAgentTypingChanged, onConnectionStateChanged (NcConnectionState: idle, connecting, connected, disconnected, offline), onUnreadCountChanged, onError (NcErrorType: network, validation, auth, system). ChatMessage carries seq, sentAt, senderName and totalMessages.
Gotchaslink
AttachmentInput.uriis afile://URI on iOS andcontent://orfile://on Android.- Multiple
NewinstanceChatinstances reconfigure one native singleton; the last config wins. - After
destroy(), construct a new instance to chat again.