fromAst static method

FieldDeclaration? fromAst(
  1. Map? ast
)

Implementation

static FieldDeclaration? fromAst(Map? ast) {
  if (ast != null &&
      ast['type'] == astNodeNameValue(AstNodeName.FieldDeclaration)) {
    var astMetadata = ast['metadata'] as List?;
    var metadatas = <Annotation?>[];
    //强制转换有问题
    if (astMetadata != null) {
      for (var arg in astMetadata) {
        metadatas.add(Annotation.fromAst(arg));
      }
    }

    return FieldDeclaration(
        VariableDeclarationList.fromAst(ast['fields']), metadatas,
        ast: ast);
  }
  return null;
}