You will now add firebase_analytics to your app and activate a custom event:
- In the dependencies section of your project's pubspec.yaml file, add the firebase_analytics package:
firebase_analytics: ^8.0.1
- In the lib folder of your project, create a new file, called happy_screen.dart.
- At the top of the new file, import material.dart and firebase_analytics:
import 'package:flutter/material.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
- Under the import statements, create a new stateful widget, calling it HappyScreen:
class HappyScreen extends StatefulWidget {
@override
_HappyScreenState createState() => _HappyScreenState();
}
class _HappyScreenState extends State<HappyScreen> {
@override
Widget build(BuildContext context) {
return Container();
}
}
- In the build method of the _HappyScreenState class, return Scaffold, with an appBar and a body. body contains a Center widget, and its child is ...