fromAst static method

MapLiteral? fromAst(
  1. Map? ast
)

Implementation

static MapLiteral? fromAst(Map? ast) {
  if (ast != null &&
      ast['type'] == astNodeNameValue(AstNodeName.SetOrMapLiteral)) {
    var astElements = ast['elements'] as List;
    var entries = <String, Expression?>{};
    var lists = <MapLiteralEntry>[];
    for (var e in astElements) {
      var entry = MapLiteralEntry.fromAst(e);
      if(entry!=null){
        entries[entry.key??''] = entry.value;
        lists.add(entry);
      }
    }
    return MapLiteral(entries, lists, ast: ast);
  }
  return null;
}