You can now get the full power of the TalkJS Data API in your Flutter mobile apps. The Data API is available through the new talkjs_core_flutter package as TalkJS Core for Flutter. It lets you read, subscribe to, and update your chat data in real time, all from your Dart code.
What is TalkJS Core?
TalkJS Core is a lightweight library that gives you direct access to your TalkJS chat data. It lets you connect to TalkJS as a user and read, subscribe to, and update chat data from Flutter-based environments.
The library is for client environments like mobile apps, connecting as a specific user via a persistent, low-latency connection to TalkJS servers. For server-side access across all conversations and users, use the REST API instead.
Why use TalkJS Core?
Using TalkJS Core for Flutter has the following advantages:
- Real-time messaging: subscribe to message and conversation events as they happen
- Full data access: read, send, and update chat data directly from your app
- Simple setup: get connected in just a few lines of Dart code
- Built for mobile: designed for client environments like Android and (soon) iOS apps
Get started in minutes
To get started using the Flutter Data API with TalkJS Core, take the following steps.
Install the package
To add the TalkJS Core Flutter package to your project, run:
flutter pub add talkjs_core_flutterMake sure your AndroidManifest.xml includes internet permission:
<uses-permission android:name="android.permission.INTERNET" />Create a session and start chatting
To connect as a user, create a TalkJS session using getTalkSession:
import 'package:talkjs_core_flutter/talkjs_core_flutter.dart';
final session = await getTalkSession(
TalkSessionOptions(
appId: '<APP_ID>', // Get this from your TalkJS dashboard
userId: '<USER_ID>', // Replace with the ID of the user you want to connect as
),
);Once connected, your session gives you access to conversations, messages, and real-time updates.
Platform support
The Flutter Data API currently supports Android (API 24+), with iOS support coming in a future update. Your project will need Dart 3.11.0+ and Flutter 3.3.0+.
Start building
Install the package or check out the documentation to start building:
Questions? Our dev team is here to help, start a chat anytime.