fromNative static method
Implementation
static List<MoveServiceWarning> fromNative(warnings) {
List<MoveServiceWarning> moveWarnings = [];
for (var warning in warnings) {
String service = warning["service"];
List reasons = warning["reasons"];
MoveDetectionService? targetService = MoveDetectionService.values
.firstWhereOrNull(
(element) => element.name.toLowerCase() == service.toLowerCase());
List<MoveWarning> targetReasons = reasons
.map((e) => MoveWarning.values.firstWhere(
(element) => element.name.toLowerCase() == e.toLowerCase()))
.toList();
moveWarnings.add(MoveServiceWarning(
service: targetService,
reasons: targetReasons,
));
}
return moveWarnings;
}