mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2026-08-24 16:50:47 +00:00
Convert 17 multi-file apps to the validated pattern: lib/main.dart keeps only the MaterialApp bootstrap; a new lib/example.dart holds the full entry screen and focused example code, importing existing supporting files (screens/, tabs/, services/, models/, widgets/, utils/). Apps: analytics_integration, animation_example, biometrics, bottom_sheet, custom_home_drawer, google_signin, grid_layout, handling_routes, image_editor, scan_qr_code, statless_counter_app, using_bottom_nav_bar, using_custom_fonts, using_listview, using_listwheelscrollview, using_platform_adaptive, view_pdf_file
Google Analytics
Steps for Analytics Integration :-
1) Setup your Flutter app in Firebase console.
2) Import Plugins in pubspec.yaml
3) Initialize FirebaseApp in main function
void main() async {
await Firebase.initializeApp();
runApp(FlutterAnalyticsApp());
}
4) Initialize FirebaseAnalytics and FirebaseAnalyticsObserver
FirebaseAnalytics analytics = FirebaseAnalytics();
FirebaseAnalyticsObserver observer = FirebaseAnalyticsObserver(analytics: analytics);
5) Setup observer to record navigation changes in app
MaterialApp(
-------------
navigatorObservers: <NavigatorObserver>[observer],
-------------
);
6) Log Events (e.g.)
await analytics.logEvent(
name: 'item',
parameters: <String, dynamic>{
'price': price,
'itemName': itemName,
'quantity': quantity,
'bool': addedToCart,
},
);
7) [Important] Enable debug mode to see events immediately
As Events in Google/Firebase analytics takes around 24 hrs to reflect, so in order to test while developing make sure that you
run a debug build. Below is the link how you can do so.


