Skip to content
pubscout

winmd

7.1.1, released 4 months ago by halildurmus.dev

Inspect and generate Windows Metadata (.winmd) files based on ECMA-335.

$ flutter pub add winmd
Source repository

What it does

Inspects and generates Windows Metadata (.winmd) files based on the ECMA-335 standard. It parses .winmd files into strongly-typed object models, queries type definitions, merges files, and programmatically generates new metadata.

AI-written summary of version 7.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to parse or generate Windows Metadata (.winmd) files in Dart
  • You are building Windows interop tooling or need to introspect WinRT types cross-platform

Skip it when

  • You are building standard cross-platform UI apps that do not deal with low-level Windows metadata

Strengths

  • Cross-platform support (Windows, macOS, Linux) via direct binary parsing
  • Rich introspection of nested types, constants, parameters, and attributes
  • Supports writing and merging metadata

Weaknesses

  • Low-level domain-specific tool, not needed for typical application development

Setup

Kind
FFI (native library)
Effort
Low
Code generation
No
Direct dependencies
7

Add the package to pubspec.yaml and import it.

import 'dart:io' as io;
import 'package:winmd/winmd.dart';

void main() {
  const winmdPath = r'C:\WINDOWS\System32\WinMetadata\Windows.Storage.winmd';
  final bytes = io.File(winmdPath).readAsBytesSync();
  final reader = MetadataReader.read(bytes);
  final index = MetadataIndex.fromReader(reader);
  final metadata = MetadataLookup(index);
  final storageFile = metadata.findSingleTypeByName('StorageFile');
  print('WinRT class "${storageFile.name}" has the following methods:');
  for (final method in storageFile.methods) {
    print('  ${method.name}');
  }
}

Alternatives

Packages that do the same job and could replace winmd.

  • mason

    Dart template generator for quick file creation

  • protobuf

    Provides runtime support for Dart protocol buffer messages generated by protoc_plugin.

  • pubspec_extract

    Extracts Dart pubspec.yaml file and generates pubspec.dart at build time

  • documentation_builder

    Generates documentation files from template files, importing other files or Dart documentation comments.

Works with

Packages commonly used together with winmd: ones it builds on, ones built on it, and its own family.