Skip to content
pubscout

minigpu

1.9.1, released 5 weeks ago by practicalxr.com

Multiplatform GPU compute for Dart and Flutter using WebGPU and Dawn.

WASM-ready
$ flutter pub add minigpu
Source repository

What it does

Brings cross-platform GPU compute shaders to Dart and Flutter applications. It integrates WGSL and WebGPU directly utilizing a Dawn backend across mobile, desktop, and web.

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

Use it when

  • You need to run high-performance compute shaders or AI-ML math models on the GPU across multiple platforms.
  • You want to process video frames or perform direct GPU buffer copies without CPU round-trips.

Skip it when

  • You are building a standard UI app that doesn't require low-level GPU acceleration.
  • You cannot handle complex native build setups involving CMake and Dawn.

Strengths

  • Cross-platform support including Windows, Linux, macOS, Web, Android, and iOS.
  • Built-in persistent shader caching to mitigate compilation overhead.
  • Direct video frame import and interop for zero-copy GPU processing.

Weaknesses

  • Dawn backend can take a long time to build and requires a recent version of CMake and Emscripten for web.
  • Experimental library with potential build friction on native platforms.

Setup

Kind
Flutter widgets
Effort
High
Code generation
No
Direct dependencies
3

Requires CMake 3.22+ and Emscripten for web. Dawn is cloned and compiled automatically on first build, which may take time. Android requires a manually supplied shader cache directory.

final gpu = Minigpu();
await gpu.init();
final shader = gpu.createComputeShader();
shader.loadKernelString('''
@group(0) @binding(0) var<storage, read_write> inp: array<f32>;
@compute @workgroup_size(256)
fn main(@builtin(global_invocation_id) id: vec3<u32>) {}
''');

Alternatives

Packages that do the same job and could replace minigpu.