MetadataWriter class final

Provides functionality to write a valid .winmd or ECMA-335 metadata file, including metadata tables, heaps, and system-level assembly references.

Constructors

MetadataWriter.new({required String name, int majorVersion = 0xFF, int minorVersion = 0xFF, int buildNumber = 0xFF, int revisionNumber = 0xFF, AssemblyFlags flags = AssemblyFlags.windowsRuntime, Guid? mvid})
Constructs a new MetadataWriter instance with the specified assembly and module information.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBytes() Uint8List
Serializes all metadata structures into a portable executable (PE) format, as specified by the Windows Metadata (.winmd) specification.
toString() String
A string representation of this object.
inherited
writeAssemblyRef({required String namespace}) AssemblyRefIndex
Adds an AssemblyRef row representing the given namespace to the file, returning its row index.
writeClassLayout({required TypeDefIndex parent, int packingSize = 0, int classSize = 0}) → void
Writes a ClassLayout row.
writeConstant({required HasConstant parent, required MetadataValue value}) → void
Writes a Constant row.
writeCustomAttribute({required HasCustomAttribute parent, required CustomAttributeType type, List<FixedArg> fixedArgs = const [], List<NamedArg> namedArgs = const []}) → void
Writes a CustomAttribute row.
writeDeclSecurity({required SecurityAction action, required HasDeclSecurity parent, required Uint8List permissionSet}) → void
Writes a DeclSecurity row.
writeEvent({required String name, NamedClassType? eventType, EventAttributes eventFlags = const EventAttributes(0)}) EventIndex
Writes an Event row, returning the corresponding index.
writeEventMap({required TypeDefIndex parent}) → void
Associates a TypeDef with the first event in its event list.
writeExportedType({required TypeDefIndex typeDefId, required String name, required Implementation implementation, String? namespace, TypeAttributes flags = const TypeAttributes(0)}) ExportedTypeIndex
Writes an ExportedType row, returning the corresponding index.
writeField({required String name, required MetadataType signature, FieldAttributes flags = const FieldAttributes(0)}) FieldIndex
Writes a Field row, returning the corresponding index.
writeFieldLayout({required int offset, required FieldIndex field}) → void
Writes a FieldLayout row.
writeFieldMarshal({required HasFieldMarshal parent, required MarshallingDescriptor descriptor}) → void
Writes a FieldMarshal row.
writeFieldRVA({required FieldIndex field, required int rva}) → void
Writes a FieldRVA row.
writeFile({required String name, required Uint8List hashValue, FileAttributes flags = const FileAttributes(0)}) FileIndex
Writes a File row, returning the corresponding index.
writeGenericParam({required int number, required TypeOrMethodDef owner, required String name, GenericParamAttributes flags = const GenericParamAttributes(0), TypeDefOrRef? constraint}) → void
Writes a GenericParam row.
writeImplMap({required MethodDefIndex method, required String importName, required String importScope, PInvokeAttributes flags = const PInvokeAttributes(0)}) → void
Writes an ImplMap row.
writeInterfaceImpl({required TypeDefIndex class$, required NamedClassType interface}) InterfaceImplIndex
Writes an InterfaceImpl row, returning the corresponding index.
writeManifestResource({required int offset, required String name, required Implementation implementation, ManifestResourceAttributes flags = const ManifestResourceAttributes(0)}) ManifestResourceIndex
Writes a ManifestResource row, returning the corresponding index.
writeMemberRef({required MemberRefParent parent, required String name, required MemberRefSignature signature}) MemberRefIndex
Writes a MemberRef row, returning the corresponding index.
writeMethodDef({required String name, int rva = 0, MethodImplAttributes implFlags = const MethodImplAttributes(0), MethodAttributes flags = const MethodAttributes(0), MethodSignature signature = const MethodSignature()}) MethodDefIndex
Writes a MethodDef row, returning the corresponding index.
writeMethodImpl({required TypeDefIndex class$, required MethodDefOrRef methodBody, required MethodDefOrRef methodDeclaration}) → void
Writes a MethodImpl row.
writeMethodSemantics({required MethodSemanticsAttributes semantics, required MethodDefIndex method, required HasSemantics association}) → void
Adds a MethodSemantics row associating a method with a property or event.
writeMethodSpec({required MethodDefOrRef method, required List<MetadataType> generics}) MethodSpecIndex
Writes a MethodSpec row, returning the corresponding index.
writeModuleRef({required String name}) ModuleRefIndex
Writes a ModuleRef row, returning the corresponding index.
writeNestedClass({required TypeDefIndex inner, required TypeDefIndex outer}) → void
Adds a NestedClass row associating an inner class with its outer class.
writeParam({required int sequence, required String name, ParamAttributes flags = const ParamAttributes(0)}) ParamIndex
Writes a Param row, returning the corresponding index.
writeProperty({required String name, required PropertySig signature, PropertyAttributes flags = const PropertyAttributes(0)}) PropertyIndex
Writes a Property row, returning the corresponding index.
writePropertyMap({required TypeDefIndex parent}) → void
Associates a TypeDef with the first property in its property list.
writeStandAloneSig({required StandAloneSignature signature}) StandAloneSigIndex
Writes a StandAloneSig row, returning the corresponding index.
writeTypeDef({required String namespace, required String name, TypeAttributes flags = const TypeAttributes(0), TypeDefOrRef extends$ = TypeDefOrRef.none}) TypeDefIndex
Writes a TypeDef row, returning the corresponding index.
writeTypeRef({required String namespace, required String name}) TypeRefIndex
Writes a TypeRef row, returning the corresponding index.
writeTypeSpec({required String namespace, required String name, List<MetadataType> generics = const []}) TypeSpecIndex
Writes a TypeSpec row, returning the corresponding index.

Operators

operator ==(Object other) bool
The equality operator.
inherited