Flutter SDK Installation

Drop-in comments UI for Flutter, powered by CommentsKit and the ready-to-use GvlCommentsList widget.

Prerequisites

Installation

From pub.dev

dependencies:
  gvl_comments: ^<latest>

Local path (monorepo)

dependencies:
  gvl_comments:
    path: packages/gvl_comments

Then:

flutter pub get

Initialize + drop-in UI

Initialize the SDK once at startup, then render GvlCommentsList anywhere in your widget tree.

import 'package:flutter/material.dart';
import 'package:gvl_comments/gvl_comments.dart';
import 'package:gvl_comments/l10n/gvl_comments_l10n.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await CommentsKit.initialize(
    installKey: const String.fromEnvironment('GVL_INSTALL_KEY'),
  );

  runApp(const DemoApp());
}

class DemoApp extends StatelessWidget {
  const DemoApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'GVL Comments Demo',
      localizationsDelegates: GvlCommentsL10n.localizationsDelegates,
      home: Scaffold(
        appBar: AppBar(title: const Text('GVL Comments Demo')),
        body: GvlCommentsList(
          threadKey: 'post:test',
          newestAtBottom: false,
          limit: 10,
          user: UserProfile(
            id: 'user_14',
            name: 'Joris43',
            avatarUrl:
                'https://gravatar.com/avatar/e26490ee50f3b620ef39386cc893b12c?s=400&d=retro&r=pg',
          ),

          theme: GvlCommentsThemeData.bubble(context),
        ),
      ),
    );
  }
}

Flutter uses threadKey strings (e.g. post:123) — no UUID thread id needed.

Moderation

All plans include basic moderation-aware rendering (pending, reported, moderated states). Paid plans additionally unlock AI-powered automatic moderation.

Updating the current user

If your user changes (login/logout, account switch), call identify() again.

final newUser = UserProfile(
  id: 'user_99',
  name: 'New Name',
  avatarUrl: 'https://…',
);

await CommentsKit.instance.identify(newUser);

CommentsKit.I() is equivalent — instance is just a nicer alias.

Force a fresh token when switching users:

CommentsKit.instance.invalidateToken();
await CommentsKit.instance.identify(newUser);

Customization