plotline_engage_web 1.0.1 copy "plotline_engage_web: ^1.0.1" to clipboard
plotline_engage_web: ^1.0.1 copied to clipboard

Flutter Web plugin for seamless integration of Plotline, a platform empowering growth and marketing teams to improve feature adoption and activation with in-app messages

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:plotline_engage_web/plotline.dart';
import 'package:plugin_plotline_example/routing/delegate.dart';
import 'package:plugin_plotline_example/routing/parser.dart';
import 'package:plugin_plotline_example/routing/route_state.dart';

import 'screens/home.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _navigatorKey = GlobalKey<NavigatorState>();
  late final RouteState _routeState;
  late final SimpleRouterDelegate _routerDelegate;
  late final TemplateRouteParser _routeParser;


  @override
  void initState() {
    _routeParser = TemplateRouteParser(
      allowedPaths: [
        '/home',
        '/artists',
        '/songs',
        '/song/:songId',
        '/artist/:artistId',
      ],
      initialRoute: '/home',
    );
    _routeState = RouteState(_routeParser);

    _routerDelegate = SimpleRouterDelegate(
      routeState: _routeState,
      navigatorKey: _navigatorKey,
      builder: (context) => HomePage(
        navigatorKey: _navigatorKey,
      ),
    );

    Plotline.init("MWIxY2JmMjMtNWU1ZS00OTUxLTk1MmYtMTU5YmQ1MTU5YzE5", "test_shubh", endpoint: "https://staging.plotline.so");
    Plotline.debug(true);
    Plotline.setPlotlineEventsListener((eventName, properties) => {
      // Your callback implementation here
      print("Plotline Callback for event: $eventName with properties: $properties")
    });

    Plotline.setPlotlineRedirectListener((properties) => {
      // Your callback implementation here
      print("Plotline Redirect Callback with properties: $properties")
    });
    super.initState();

  }

  @override
  void dispose() {
    _routeState.dispose();
    _routerDelegate.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return PlotlineWrapper(
        child: RouteStateScope(
          notifier:  _routeState,
          child: MaterialApp.router(
            routerDelegate: _routerDelegate,
            routeInformationParser: _routeParser,
          ),
        )
    );
  }

}
6
likes
0
points
1.78k
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter Web plugin for seamless integration of Plotline, a platform empowering growth and marketing teams to improve feature adoption and activation with in-app messages

Homepage

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, js, plugin_platform_interface, visibility_detector

More

Packages that depend on plotline_engage_web