List<T>? as<T>(List? children) { if (children == null) { return null; } if (children.isEmpty) { return []; } return children.map((e) => e as T).toList(); }