Log events no firebase #85
-
Tudo bom galera? To com uma dúvida de como logar eventos no firebase.
documentação que usei: Eventos de registro, Configurar a coleta e o uso de dados do Analytics firebase_core: ^2.3.0
firebase_analytics: ^10.0.6 Future<void> initializeFirebaseData() async {
...
_initTime = DateTime.now();
await EasyLoading.show(
status: 'Baixando rotas...',
maskType: EasyLoadingMaskType.black,
);
await _routeRepository.getRoutes(personId, organizationId);
final _routesDownloadTime = DateTime.now();
await EasyLoading.show(
status: 'Baixando alarmes...',
maskType: EasyLoadingMaskType.black,
);
await _alarmsUserPrioritiesRepository.getUserAlarmPriority(organizationId);
final _alarmsDownloadTime = DateTime.now();
await EasyLoading.show(
status: 'Baixando justificativas...',
maskType: EasyLoadingMaskType.black,
);
await _noResponseJustificationRepository.getUserNoResponseJustification(
organizationId,
);
final _justificationDoownloadTime = DateTime.now();
analytics.setAnalyticsCollectionEnabled(true);
analytics.logEvent(name: 'sync_event', parameters: <String, dynamic>{
'routes_download_time':
_routesDownloadTime.difference(_initTime).inSeconds,
'alarms_download_time':
_alarmsDownloadTime.difference(_routesDownloadTime).inSeconds,
'justification_download_time':
_justificationDoownloadTime.difference(_alarmsDownloadTime).inSeconds,
'total_time':
_justificationDoownloadTime.difference(_initTimeUpload).inSeconds,
});
log("time: ${_justificationDoownloadTime.difference(_initTimeUpload).inSeconds}");
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@lucasgm1997 não ficou claro qual a sua dúvida. Está dando algum erro na execução desse código e não está logando? |
Beta Was this translation helpful? Give feedback.
-
Consegui fazer no emulador fisico, obrigado @eduardoflorence. |
Beta Was this translation helpful? Give feedback.
Consegui fazer no emulador fisico, obrigado @eduardoflorence.