metadataAsSection function

Map<String, dynamic> metadataAsSection(
  1. Map<String, dynamic> metadataContents
)

Accepts the contents of a $metadata JSON that was probably loaded from a file Returns the $metadata changed so that it works in a single JSON structure

Implementation

Map<String, dynamic> metadataAsSection(Map<String, dynamic> metadataContents) {
  Map<String, dynamic> massagedMetadata = {};

  List<dynamic> metadataTokenSetOrder =
      metadataContents['tokenSetOrder'] as List<dynamic>;
  //_print('tokenSetOrder is $metadataTokenSetOrder');
  massagedMetadata = <String, dynamic>{};
  massagedMetadata['tokenSetOrder'] =
      metadataTokenSetOrder.map((path) => basename(path.toString())).toList();

  // _print('massagedMetadata has entries: ${massagedMetadata.keys.toList()}');
  // _print(
  //     'massagedMetadata.\$metadata has entries: ${massagedMetadata["\$metadata"]}');
  // _print(
  //     'massagedMetadata.\$metadata.tokenSetOrder has entries: ${massagedMetadata["\$metadata"]["tokenSetOrder"]}');

  return massagedMetadata;
}