Docs
Flutter
A Dart package with a ready-made chat page.
Quickest way: one command
npx @octokan/cli init app_xxxxxxxxxxxx https://YOUR-BACKEND
Run it from your project's folder (it needs Node.js). It adds octokan_sdk to pubspec.yaml, creates lib/octokan_setup.dart, calls it from main() and runs flutter pub get. Your app key and backend URL are on the Install page of the dashboard. The manual steps below are exactly what it does.
The Flutter package supports iOS and Android and lives in sdks/flutter of the octokan repository.
1. Add the package
# pubspec.yaml
dependencies:
octokan_sdk:
path: path/to/Octokan/sdks/flutter2. Configure once
import 'package:octokan_sdk/octokan_sdk.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Octokan.configure(appId: 'app_xxxxxxxxxxxx', baseUrl: 'https://YOUR-BACKEND');
runApp(const MyApp());
}3. Show the chat
OctokanChatButton(label: 'Chat with us') // or from your own button Octokan.open(context); // or embed the page OctokanChat()
Know who's writing
Octokan.identify(id: user.id, email: user.email, name: user.name); // on sign-out await Octokan.reset();
Run it
flutter run on a simulator, an emulator or a connected phone. From the Android emulator a backend on your own computer is http://10.0.2.2:4000, and it needs cleartext traffic allowed in the debug manifest.