Dart code generator for helping with (firebase) analytics.

Overview

analytics_events_gen

An easy generator for tracking firebase analytics events via type safe methods.

Add to pubspec.yaml

Check pub for the latest version: Pub

dependencies:
  # ...
  analytics_event_gen: 0.1.0
dev_dependencies:
  # include build_runner, only used for code generation.
  build_runner: ^1.6.5

Create AnalyticsEvents class:

// analytics.dart

import 'package:analytics_event_gen/analytics_event_gen.dart';

// this file will be generated.
part 'analytics.g.dart';

class MyAnalyticsBloc {
  MyAnalyticsBloc() {
    // initialize generated events class implementation.
    // the generated code will simply transform the method name
    // into an `eventName` and pass it to your callback method.
    // you can then do whatever you want with it, e.g. send to 
    // firebase analytics.
    events.registerTracker((eventName, params) {
      FirebaseAnalytics().logEvent(name: event, parameters: params);
    });
  }
  
  final events = _$AnalyticsEvents();
}

abstract class AnalyticsEvents implements AnalyticsEventStubs {
  void trackMyUserInteraction({double myProp, String yourProp});
}

By default the library will use null safety syntax. This can be disabled using build.yaml file:

targets:
  $default:
    builders:
      analytics_event_gen|analytics_event_builder:
        options:
          useNullSafetySyntax: true

Run the build generator

# For flutter projects
flutter pub pub run build_runner build --delete-conflicting-outputs

# For dart projects
pub run build_runner build --delete-conflicting-outputs
You might also like...

Code generator for Flutter's theme extension classes.

Code generator for Flutter's theme extension classes.

Welcome to Theme Tailor, a code generator and theming utility for supercharging Flutter ThemeExtension classes introduced in Flutter 3.0! The generato

Jan 2, 2023

Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.

Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.

Dart_Native Dart_Native operates as both a code generator tool and a bridge to communicate between Dart and native APIs. Replaces the low-performing F

Jan 4, 2023

Shader manages the compilation of your GLSL shaders into SPIR-V byte code and Dart code

shader Shader manages the compilation of your GLSL shaders into SPIR-V byte code and Dart code. Quickstart # Install cli dart pub global activate shad

Dec 1, 2022

Let's setup Firebase​​ for our Flutter​​ app on Android​, iOS​ and Flutter Web. Setup Firebase to use Firebase products.

Let's setup Firebase​​ for our Flutter​​ app on Android​, iOS​ and Flutter Web.  Setup Firebase to use Firebase products.

Flutter Tutorial - Firebase Setup For Flutter Web Let's setup Firebase for our Flutter app on Android, iOS and Flutter Web. Setup Firebase to use Fire

Apr 27, 2022

Dart and Flutter sealed class generator and annotations, with match methods and other utilities. There is also super_enum compatible API.

Dart Sealed Class Generator Generate sealed class hierarchy for Dart and Flutter. Features Generate sealed class with abstract super type and data sub

Jan 2, 2023

Dart Class Diagram Generator

Dart Class Diagram Generator

Dart Class Diagram Generator A small command line utility to generate a class (UML or similar) diagram from a Dart package. Examples Below is a UML di

Dec 29, 2022

Simple, random string generator for Dart

Simple Random String Simple, random string generator Features Lower characters Upper characters Numbers Customizable special characters Repeatable or

Dec 19, 2022

A generator for fhir dart classes with json artifacts.

A generator for fhir dart classes with json artifacts. Thie generator uses the freezed package to generate the data classes. It also uses all the primitive_types from the fhir package.

Jun 14, 2022

This is a simple Gantt chart generator written as Dart command line tool.

This is a simple Gantt chart generator written as Dart command line tool.

Gantt Chart Generator This is a simple Gantt chart generator written as Dart command line tool. Currently the tool generates an HTML/CSS Gantt chart.

Apr 26, 2022
Owner
Herbert Poul
Freelance app developer @ https://codeux.design/ Check out my latest OSS project at https://authpass.app/
Herbert Poul
Enum extendable - Dart code generator. Generates enum extensions code.

Generates code for the extension on an enum. Overview Being able to add fields and methods to an enum. Let's say we have the following enum: enum Math

null 0 Jan 10, 2022
A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your issue.

r_scan A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your iss

PengHui Li 112 Nov 11, 2022
Startup-Name-Generator-App-in-Flutter - Business Startup Name Generator App in Flutter

Business Startup Name Generator App #About APP: A simple mobile app that generat

AHSAN SIDDZ 0 Jan 30, 2022
Official Flutter Tracking Library for Mixpanel Analytics

Table of Contents Introduction Quick Start Guide Install Mixpanel Initialize Mixpanel Send Data Check for Success I want to know more! Introduction We

Mixpanel, Inc 46 Jan 4, 2023
Software analytics tool that helps developers analyse and improve software quality.

Dart Code Metrics Note: you can find the full documentation on the website Configuration | Rules | Metrics | Anti-patterns Dart Code Metrics is a stat

Dart Code Checker 745 Dec 26, 2022
A mobile wallet, that keeps track of a user's spending with analytics.

credit_clan_task A mobile wallet, that keeps track of a user's spending with analytics. Getting Started This project is a task assigned by Credit clan

Godson 2 Apr 30, 2022
A convenient code generator for app styleguide, gallery, wireframes and/or storyboard.

Framy A convenient code generator for app styleguide, gallery, wireframes and/or storyboard. ?? Official documentation ?? Packages In order to use Fra

Fidev 145 Dec 19, 2022
The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!

SwiftGen SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them ty

null 8.3k Dec 31, 2022
bq Scanner : An QR Code and Barcode Scanner and Generator.

bq Scanner A Barcode Scanner. A QR Code Scanner. A Barcode Generator. A QR Code Generator. Visit bq Scanner at https://ritikpatle.github.io/bqscanner/

Ritik Patle 4 Jun 5, 2022
Adobe XD Flutter Code Generator - Plugin

Adobe XD Flutter Code Generator - Plugin

Giovani Lobato 337 Dec 28, 2022