Complete the code to import the Firebase Analytics package in Flutter.
import '[1]';
The correct import for Firebase Analytics in Flutter is package:firebase_analytics/firebase_analytics.dart.
Complete the code to create an instance of FirebaseAnalytics.
final FirebaseAnalytics analytics = FirebaseAnalytics[1]();FirebaseAnalytics uses a singleton pattern accessed via FirebaseAnalytics.instance.
Fix the error in the code to log a custom event named 'purchase' with a parameter 'item_id'.
await analytics.logEvent(name: '[1]', parameters: {'item_id': '12345'});
The event name should be a simple string like 'purchase' to follow Firebase Analytics naming conventions.
Fill both blanks to set the user ID and user property in Firebase Analytics.
await analytics.setUserId(id: '[1]'); await analytics.setUserProperty(name: '[2]', value: 'premium');
The user ID can be any string like 'user123'. The user property name should be descriptive like 'user_type'.
Fill all three blanks to log a screen view event with screen name and screen class.
await analytics.logScreenView(screenName: '[1]', screenClass: '[2]', [3]);
The screenName is 'HomePage', screenClass is 'MainScreen', and the optional parameter is screenClassOverride with value 'MainScreen'.