Add Flutter SDK to your app
Learn how to add the CommentSystem SDK to your Flutter app.
Add the SDK
You can use the CommentSystem to query information about the application package. This works both on iOS and Android.
import 'package:flutter/material.dart';
import 'package:comment_system/comment_system.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _commentSystemPlugin = CommentSystem();
bool _initialized = false;
@override
void initState() {
super.initState();
_initSDK();
}
Future<void> _initSDK() async {
try {
// Valid Google Client ID from native sample
await _commentSystemPlugin.initialize(
'965248938438-sek5ogfs5r6kafai6k4hn2v5vup0n3ai.apps.googleusercontent.com',
);
if (mounted) {
setState(() {
_initialized = true;
});
}
} catch (e) {
debugPrint('Error initializing SDK: $e');
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Arena Comment System Example')),
body: _initialized
? const ArenaCommentSystem(
siteId: '63fcccb507ef286ceceddccc',
url: 'https://sportspage.arena.im/2025/05/14/ricardo-comment-system-dev-test/?noamp=mobile',
pageTitle: 'ricardo comment system dev test – Sports Page',
threadId: 'standalone_ri',
threadProfileId: 'sportspage-arena-im-2025-05-14-ricardo-comment-system-dev-test',
environment: ArenaEnvironment.development,
)
: const Center(child: CircularProgressIndicator()),
),
);
}
}
Requirements
- Flutter >= 3.19.0
- Dart >= 3.3.0
- iOS >= 15.0
- Java 17
- Kotlin 2.2.0
- Android Gradle Plugin >= 8.12.1
- Gradle wrapper >= 8.13
Updated about 7 hours ago