lib_npaw_plugin_flutter 1.1.8
lib_npaw_plugin_flutter: ^1.1.8 copied to clipboard
A Flutter adapter for the NPAW's Youbora Lib.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:lib_npaw_plugin_flutter/constants.dart';
import 'package:lib_npaw_plugin_flutter/lib_npaw_plugin_flutter.dart';
import 'package:lib_npaw_plugin_flutter_example/screens/app_analytics.dart';
import 'package:lib_npaw_plugin_flutter_example/screens/video_analytics.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
// Initialize the library
final plugin = LibNpawPluginFlutter();
@override
void initState() {
super.initState();
plugin.setupNpawPlugin('myAccountCode'); // Setup the plugin with the account code
plugin.setLogLevel(NpawConstants.LogLevel_debug); // Set the debug level
plugin.options.setAppName('Flutter Example App'); // Set the desired options
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
title: const Text('NPAW Plugin Example'),
bottom: const TabBar(
tabs: [
Tab(text: 'App Analytics'),
Tab(text: 'Video Analytics'),
],
),
),
body: TabBarView(
children: [
AppAnalyticsScreen(plugin: plugin),
VideoAnalyticsScreen(plugin: plugin)
],
),
),
),
);
}
}