fromNdJson static method

List<Resource> fromNdJson(
  1. String content
)

Accepts a String in ndJson format and converts it into a list of resources

Implementation

static List<Resource> fromNdJson(String content) {
  final List<String> resourceStrings = content.split('\n');
  final List<Resource> resourceList = <Resource>[];
  for (final String resource in resourceStrings) {
    if (resource.isNotEmpty) {
      resourceList.add(
          Resource.fromJson(jsonDecode(resource) as Map<String, dynamic>));
    }
  }
  return resourceList;
}