Groveman Analytics
Analytics for Dart/Flutter applications, inspired by the same concepts of tree and planting as groveman.
Behavior is added through AnalyticsTree instances. Install an instance by calling GrovemanAnalytics.plantTree. Installation should be done as early as possible, e.g, in the main function.
Usage
Add it in your pubspec.yaml:
dependencies:
groveman_analytics:
Import it where you want to use it e.g, in your main file.
import 'package:groveman_analytics/groveman_analytics.dart';
Define your analytics events by extending AnalyticsEvent:
class PurchaseCompletedEvent extends AnalyticsEvent {
PurchaseCompletedEvent(this.value);
final double value;
@override
String get eventName => 'purchase_completed';
@override
Map<String, dynamic>? get properties => {'value': value};
}
// Events without properties just omit the override
class AppOpenedEvent extends AnalyticsEvent {
@override
String get eventName => 'app_opened';
}
Plant a tree and start tracking:
void main() {
GrovemanAnalytics.plantTree(MyAnalyticsTree());
runApp(const MyApp());
}
API
track
Sends an analytics event to all planted trees.
await GrovemanAnalytics.track(PurchaseCompletedEvent(99.9));
identify
Associates the current user with all planted trees.
await GrovemanAnalytics.identify(
'user_123',
properties: {'plan': 'pro', 'name': 'John'},
);
setSuperProperties / clearSuperProperties
Properties automatically attached to every event.
await GrovemanAnalytics.setSuperProperties({
'app_version': '1.0.0',
'environment': 'production',
});
await GrovemanAnalytics.clearSuperProperties();
enable / disable
Controls whether analytics data is collected. Useful for GDPR consent flows.
// User declined consent
await GrovemanAnalytics.disable();
// User accepted consent
await GrovemanAnalytics.enable();
reset
Clears the current user session. Call this on user logout.
await GrovemanAnalytics.reset();
Creating a custom tree
Extend AnalyticsTree to send events to any analytics service:
class MyAnalyticsTree extends AnalyticsTree {
@override
Future<void> track(AnalyticsEvent event) async {
myService.logEvent(event.eventName, event.properties);
}
@override
Future<void> identify(String userId, {Map<String, dynamic>? properties}) async {
myService.identify(userId, properties);
}
@override
Future<void> setSuperProperties(Map<String, dynamic> properties) async {
myService.registerSuperProperties(properties);
}
@override
Future<void> clearSuperProperties() async {
myService.clearSuperProperties();
}
@override
Future<void> enable() async => myService.enable();
@override
Future<void> disable() async => myService.disable();
@override
Future<void> reset() async => myService.reset();
}
Officially supported trees
📝 Maintainers
🤝 Support
You liked this package? Then give it a ⭐️. If you want to help then:
- Fork this repository
- Send a Pull Request with new features
- Share this package
- Create issues if you find a bug or want to suggest a new extension
Pull Request title follows Conventional Commits. The scope available is groveman_analytics.
📝 License
Copyright © 2026 Kauê Martins.
This project is MIT licensed.