Flutter & Firebase - Firebase Analytics 为匿名用户设置用户属性

Flutter & Firebase- Firebase Analytics setUserProperty for Anonymous users

无法设置用户 属性- 在 Flutter Web 中获取 TypeError: Cannot read property 'statusCode' of null

试试

WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  UserCredential userCredential = await FirebaseAuth.instance.signInAnonymously();
  FirebaseAnalytics analytics = FirebaseAnalytics();
analytics.setUserId(userCredential.user.uid);
analytics.setUserProperty(name:"xxxx",value:"xxxxx");