convertFirebaseProperty method
Implementation
Map<String, dynamic> convertFirebaseProperty(Map<String, dynamic>? input) {
if (input == null) {
return {};
}
var properties = Map<String, dynamic>.of(input);
input.forEach((key, value) {
// only alpha numeric key is supported in Firebase Analytics
if (key.isAlphaNumeric) {
if (isSupportedType(value.runtimeType)) {
if (value is DateTime) {
properties[key] = value
.toUtc()
.toIso8601String()
.replaceAll(RegExp(r'\.\d+Z*'), '');
}
/*
if (value is LocalDateTime) {
properties[key] = value
.toDateTimeLocal()
.toIso8601String()
.replaceAll(RegExp(r'\.\d+Z*'), '');
}
if (value is LocalDate) {
properties[key] = value.toString('yyyy-MM-dd');
}
*/
} else {
properties[key] = value.toString();
}
} else {
properties.remove(key);
}
});
return properties;
}