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
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.
- vector_graphics_compilerSame familyA compiler to convert SVGs to the binary format used by package:vector_graphics.
- vector_graphicsSame familyA vector graphics rendering package for Flutter using a binary encoding.
- vector_graphics_codecSame familyEncoding and decoding library for the vector_graphics binary format
- path_parsingBuilt on vector_mathPure Dart library for parsing SVG path strings and generating Dart path code.
- material_uiBuilt on vector_mathOfficial Flutter Material UI library implementing Google’s Material Design system.
- fl_chartBuilt on vector_mathA highly customizable Flutter chart library that supports Line Chart, Bar Chart, Pie Chart, Scatter Chart, and Radar Chart.
- lottieBuilt on vector_mathRender After Effects JSON animations natively in Flutter.
- pdfBuilt on vector_mathA PDF generation library for Dart and Flutter using a widget-like layout system.