leaveAnimations method

JsonMap leaveAnimations(
  1. List<String> names
)

Leaves animation contains names.

Implementation

JsonMap leaveAnimations(List<String> names) {
  final newJson = json;
  final animations = newJson['animations'] as JsonMap;
  final keptAnimations = <String, dynamic>{};
  for (final kv in animations.entries) {
    if (names.contains(kv.key)) {
      keptAnimations[kv.key] = kv.value;
    }
  }
  newJson['animations'] = keptAnimations;

  return newJson;
}