RiveEvent.fromCoreEvent constructor
RiveEvent.fromCoreEvent(
- Event event
Implementation
factory RiveEvent.fromCoreEvent(Event event) {
final Map<String, dynamic> properties = {};
for (final property in event.customProperties) {
dynamic value;
switch (property.coreType) {
case CustomPropertyNumberBase.typeKey:
value = (property as CustomPropertyNumber).propertyValue;
break;
case CustomPropertyStringBase.typeKey:
value = (property as CustomPropertyString).propertyValue;
break;
case CustomPropertyBooleanBase.typeKey:
value = (property as CustomPropertyBoolean).propertyValue;
break;
}
if (value != null) {
properties[property.name] = value;
}
}
if (event.coreType == OpenUrlEventBase.typeKey) {
event = event as OpenUrlEvent;
return RiveOpenURLEvent(
name: event.name,
url: event.url,
target: event.target,
secondsDelay: event.secondsDelay,
properties: properties,
);
} else {
return RiveGeneralEvent(
name: event.name,
secondsDelay: event.secondsDelay,
properties: properties,
);
}
}