plotline_insights 2.1.6 copy "plotline_insights: ^2.1.6" to clipboard
plotline_insights: ^2.1.6 copied to clipboard

The official flutter plugin for Plotline's SDK. Android and iOS support for studies. Flows is currently no-op in iOS.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:plotline_insights/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.debug(true);
    Plotline.init("<apiKey>", "<userId>");
    super.initState();

  }

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

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

}
1
likes
140
pub points
60%
popularity

Publisher

unverified uploader

The official flutter plugin for Plotline's SDK. Android and iOS support for studies. Flows is currently no-op in iOS.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on plotline_insights