Skip to content
pubscout

vector_math

2.4.4, released 4 weeks ago by flutter.dev

Vector math library for 2D/3D/4D vectors, matrices, quaternions, and geometry.

WASM-readyRock solid
$ flutter pub add vector_math
Source repository

What it does

Provides fast, well‑tested vector and matrix types for 2D, 3D, and 4D space, including quaternions, colors, and collision primitives. It is heavily optimized and fully documented.

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

Use it when

  • Need efficient linear algebra for graphics or physics
  • Building a game or simulation
  • Performing 3D transformations or camera math
  • Working with collision detection or ray‑casting

Skip it when

  • You only need simple math operations that can be handled by Dart's core libraries
  • Your project is already using a different math library that covers the same features

Strengths

  • Highly optimized and battle‑tested in Flutter and Flame
  • Supports 64‑bit precision via a drop‑in import
  • Fully documented and well‑tested

Weaknesses

  • No built‑in UI widgets or rendering helpers
  • Limited to math; no higher‑level abstractions for game engines

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:vector_math/vector_math.dart';

void main() {
  Vector3 v = Vector3(1, 2, 3);
  Matrix4 m = Matrix4.rotationY(3.1415 / 4);
  v = m.transform3(v);
  print(v);
}

Works with

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