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

analytics_logger_gen is a Flutter plugin that generates an integrated event logger for various analytics tools including Firebase, AppsFlyer, Amplitude, Mixpanel, Singular, and DataDog. Import data fr [...]

example/lib/main.dart

// ignore: depend_on_referenced_packages
import 'package:analytics_logger_gen/analytics_logger_gen.dart';

// ignore: depend_on_referenced_packages
import 'package:flutter/material.dart';

import '../event_logger_impls/event_loggers.dart';

part 'main.g.dart';

@AnalyticsLogger(
    localCsvPath: 'assets/logger_gen_example_v2.csv',
    loggers: {
      FirebaseAnalyticsLogger: 'enableFirebase',
      AppsFlyerLogger: 'hasAppsFlyer',
      AmplitudeLogger: 'customizableName1',
      MixpanelLogger: 'customizableName2',
      SingularLogger: 'customizableName3',
      DatadogDebugLogger: 'customizableName4',}
)
// ignore: unused_element
class _CommonAnalyticsLogger {}

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
    AnalyticsEventProvider.countIncreased(count: _counter);
  }

  @override
  void initState() {
    super.initState();
    CommonAnalyticsLogger.setup();
    AnalyticsEventProvider.appStarted();
  }

  @override
  void dispose() {
    AnalyticsEventProvider.appEnded();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
9
likes
0
pub points
56%
popularity

Publisher

verified publishereido9oya.com

analytics_logger_gen is a Flutter plugin that generates an integrated event logger for various analytics tools including Firebase, AppsFlyer, Amplitude, Mixpanel, Singular, and DataDog. Import data from Google Spreadsheets, remote repositories, or local CSV files.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, change_case, csv, flutter, http, path, source_gen

More

Packages that depend on analytics_logger_gen