channels_flutter 0.1.0
channels_flutter: ^0.1.0 copied to clipboard
Client SDK for embedding a Channels.social community as a native screen — a WebView-backed widget with passthrough auth. Requires a Channels.social account.
channels_flutter #
Embed a Channels.social community as a native screen
in your Flutter app. It's a webview_flutter-backed widget with passthrough
auth — pass your signed-in member and they're logged in with no extra screen.
Renders on iOS and Android from one codebase.
Phase 1 is embed only. Push notifications are a planned add-on (see below).
Requires a Channels account #
This is a client SDK for Channels.social — it embeds your community, so it needs a Channels account (a paid product) and your API key. Sign up at https://channels.social, then copy your key from Admin → Integration. The widget does nothing without a valid key.
Install #
# pubspec.yaml
dependencies:
channels_flutter: ^0.1.0
flutter pub get
Usage #
Give it a bounded size (e.g. a Scaffold body or an Expanded):
import 'package:channels_flutter/channels_flutter.dart';
Scaffold(
body: ChannelsCommunity(
apiKey: 'YOUR_API_KEY',
user: ChannelsUser(
externalId: 'u_123', // your user id (preferred)
name: 'Jane',
email: 'jane@acme.com',
),
// channel: 'general', // optional: open a specific channel/topic
// theme: 'dark', // optional: 'light' | 'dark'
),
)
Get your apiKey from the admin Integration tab.
Props #
| Param | Type | Notes |
|---|---|---|
apiKey |
String (req) |
Your community's public API key. |
user |
ChannelsUser? |
Member to sign in (passthrough). |
channel |
String? |
Open directly on this channel (by name). |
topic |
String? |
Open directly on this topic (by name). |
theme |
String? |
'light' or 'dark'. |
host |
String |
Override host (staging/self-host). |
onEvent |
void Function(String)? |
Raw embed postMessage payloads. |
ChannelsCommunity also accepts loadingBuilder and errorBuilder to
customize those states.
Passthrough auth #
When you pass a user with an externalId or email, the SDK loads the embed
with autoLogin=true and the identity params, so the member is signed in
automatically — provided the community's auth mode is Trusted or JWT (set in
the admin panel). On other auth modes the embed shows its normal login.
The SDK sends: external_id / email / name / image (whichever you
provide) as query params on the embed URL.
Platform setup #
Android — webview_flutter needs minSdkVersion 19+ (check
android/app/build.gradle). The INTERNET permission is included by default;
no extra config.
iOS — works over HTTPS out of the box; no App Transport Security changes
needed. Run cd ios && pod install after adding the dependency.
Roadmap: push notifications #
Native push (mentions, DMs, Talk-to-us replies) is a planned add-on. It will use
firebase_messaging to register the device with the Channels backend and a
WebView JavaScript channel to deep-link into the right channel on tap — the same
phased approach as the React Native SDK. It is intentionally not in this
version, so embedding requires no Firebase setup.
License #
MIT