heyinsight_package 1.1.13
heyinsight_package: ^1.1.13 copied to clipboard
This is package for heyinsight with notification features. @HeySheep
example/lib/main.dart
import 'package:example/screens/detail.dart';
import 'package:example/screens/home.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:heyinsight_package/heyinsight_package.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await HeyInsight.initApp(
android: HsAppOptions(
apiKey: '',
appId: '',
),
ios: HsAppOptions(
apiKey: '',
appId: '',
),
);
await HSNotification.initNotification();
runApp(MyApp());
}
final journeyTrackerObserver = JourneyTrackerObserver();
final GoRouter _router = GoRouter(
observers: [journeyTrackerObserver],
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return const HomeScreen();
},
routes: <RouteBase>[
GoRoute(
path: 'details',
builder: (BuildContext context, GoRouterState state) {
return const DetailsScreen();
},
),
],
),
],
);
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _AppState();
}
class _AppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return HsAnalyticsProvider(
journeyTrackerObserver: journeyTrackerObserver,
builder: (context) {
return MaterialApp.router(
routerConfig: _router,
);
});
}
}