heyinsight_package 1.1.10 copy "heyinsight_package: ^1.1.10" to clipboard
heyinsight_package: ^1.1.10 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());
}

class MyApp extends StatelessWidget {
  MyApp({
    super.key,
  });
  final journeyTrackerObserver = JourneyTrackerObserver();
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return HsAnalyticsProvider(
        journeyTrackerObserver: journeyTrackerObserver,
        builder: (context) {
          return MaterialApp.router(
            routerConfig: 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();
                      },
                    ),
                  ],
                ),
              ],
            ),
          );
        });
  }
}