winmd 2.4.5 icon indicating copy to clipboard operation
winmd: ^2.4.5 copied to clipboard

A Dart library for working with Windows Metadata (winmd) formats.

This package provides a Dart language abstraction over Windows metadata files, making it possible to load them and build Dart FFI interop libraries from the results. It can be used to interrogate the Windows developer API, whether unmanaged APIs like Win32 or COM, or APIs like Windows Runtime that include their own metadata.

pub package package publisher Language Build codecov

Architecture #

Architecture diagram

Usage (Windows Runtime) #

A simple example: loading the MediaPlayer class and retrieving information about its methods.

import 'package:winmd/winmd.dart';

void main() {
  // A Windows Runtime interface
  const typeToGenerate = 'Windows.Media.Playback.MediaPlayer';

  // Load the metadata for this interface
  final typeDef = MetadataStore.getMetadataForType(typeToGenerate)!;

  // Create a Dart projection
  print('$typeToGenerate contains the following methods:');

  for (final method in typeDef.methods) {
    print('  ${}');

Usage (Win32) #

Load all the methods from the GDI namespace and print out some metadata.

import 'package:winmd/winmd.dart';

void main() {
  // Load WinMD metadata for Win32, as produced by the following utility:
  final scope = MetadataStore.getWin32Scope();

  // Find a namespace
  final namespace =

  // Sort the functions alphabetically
  final sortedMethods = namespace.methods
    ..sort((a, b) =>;

  // Find a specific function
  const funcName = 'MessageBoxW';
  final method = sortedMethods.firstWhere((m) => == funcName);

  // Print out some information about it
  print('Win32 function $funcName [token #${method.token}]');

  // Retrieve its parameters and project them into Dart FFI types
  final params = method.parameters
      .map((param) =>
          '${'.').last} ${}')
      .join(', ');
  print('The parameters are:\n  $params');

  final returnType ='.').last;
  print('It returns type: $returnType.');

Features and bugs #

Please file feature requests and bugs at the issue tracker.

pub points


verified publisher

A Dart library for working with Windows Metadata (winmd) formats.

Repository (GitHub)
View/report issues


API reference


Icon for licenses.BSD-3-Clause (LICENSE)


ffi, win32


Packages that depend on winmd