A fast and space efficient library to deal with data in Dart, Flutter and the web.

Overview

Dart Data

Pub Package Build Status Code Coverage GitHub Issues GitHub Forks GitHub Stars GitHub License

Dart Data is a fast and space efficient library to deal with data in Dart, Flutter and the web. As of today this mostly includes data structures and algorithms for vectors and matrices, but at some point might also include graphs and other mathematical structures.

This library is open source, stable and well tested. Development happens on GitHub. Feel free to report issues or create a pull-request there. General questions are best asked on StackOverflow.

The package is hosted on dart packages. Up-to-date class documentation is created with every release.

Tutorial

Below are step-by-step instructions of how to use this library. More elaborate examples are included with the examples.

Installation

Follow the installation instructions on dart packages.

Import the core-package into your Dart code using:

import 'package:data/data.dart';

How to solve a linear equation?

Solve 'A * x = b', where 'A' is a matrix and 'b' a vector:

final a = Matrix<double>.fromRows(DataType.float64, [
  [2, 1, 1],
  [1, 3, 2],
  [1, 0, 0],
]);
final b = Vector<double>.fromList(DataType.float64, [4, 5, 6]);
final x = a.solve(b.columnMatrix).column(0);
print(x.format(valuePrinter: Printer.fixed()); // prints '6 15 -23'

How to find the eigenvalues of a matrix?

Find the eigenvalues of a matrix 'A':

final a = Matrix<double>.fromRows(DataType.float64, [
  [1, 0, 0, -1],
  [0, -1, 0, 0],
  [0, 0, 1, -1],
  [-1, 0, -1, 0],
]);
final decomposition = a.eigenvalue;
final eigenvalues = Vector<double>.fromList(
    DataType.float64, decomposition.realEigenvalues);
print(eigenvalues.format(valuePrinter: Printer.fixed(precision: 1))); // prints '-1.0 -1.0 1.0 2.0'

How to find all the roots of a polynomial?

To find the roots of x^5 + -8x^4 + -72x^3 + 242x^2 + 1847x + 2310:

final polynomial = Polynomial.fromCoefficients(DataType.int32, [1, -8, -72, 242, 1847, 2310]);
final roots = polynomial.roots;
print(roots.map((root) => root.real)); // [-5, -3, -2, 7, 11]
print(roots.map((root) => root.imaginary)); // [0, 0, 0, 0, 0]

Misc

License

The MIT License, see LICENSE.

The matrix decomposition algorithms are a direct port of the JAMA: A Java Matrix Package, that is released under public domain.

You might also like...

Natrium - Fast, Robust & Secure NANO Wallet, now written with Flutter.

Natrium - Fast, Robust & Secure NANO Wallet, now written with Flutter.

Natrium - Fast, Robust & Secure NANO Wallet What is Natrium? Natrium is a cross-platform mobile wallet for the NANO cryptocurrency. It is written in D

Dec 30, 2022

A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.

A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.

cross_connectivity A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Androi

Nov 15, 2022

A Dart library for creating a Dart object to represent directory trees.

Directory Tree A Dart library for creating a Dart object to represent directory trees. Getting Started Import and initialize package import 'package:d

Dec 1, 2021

GChat is a chatting application developed using Flutter(Dart) and firebase for 2 users. Trying to Develop an application that does not sell your data with whatsapp rolling out its privacy policy updates.

GChat is a chatting application developed using Flutter(Dart) and firebase for 2 users. Trying to Develop an application that does not sell your data with whatsapp rolling out its privacy policy updates.

Gchat - The Chatting Application A Flutter project for chatting. I used Android Studio and you can you any editor of your choice for ex: VS Code, Inte

Nov 6, 2022

🚀 Full-Stack Flutter application, encoded using Dart. Utilizes native device features 📷 and stores user data on a local SQFLite database. ✔

great_places_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Jan 24, 2022

An intuitive way to work with persistent data in Dart

An intuitive way to work with persistent data in Dart. Full documentation Why Brick? Out-of-the-box offline access to data Handle and hide complex ser

Dec 26, 2022

A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.

Dec 30, 2022

Task List application developed in Dart language with SDK Flutter for Android, iOS and Web

Task List application developed in Dart language with SDK Flutter for Android, iOS and Web

Task List application developed in Dart language with SDK (Software Development Kit) Flutter for Android, iOS and Web.

Jun 2, 2022

Postgres-conector - A library for connecting to and querying PostgreSQL databases in Dart.

TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them. Features TODO: List w

Nov 14, 2021
Comments
  • How to find eigenvalues?

    How to find eigenvalues?

    Hi.

    I'm trying to get eigenvalues for a matrix. I do:

    var m = Matrix.builder.withType(DataType.float64).fromRows([
        [1, 0, 0, -1],
        [0, -1, 0, 0],
        [0, 0, 1, -1],
        [-1, 0, -1, 0]
      ]);
    var e = eigenvalue(m);
    

    I inspect the object but I can't find the result (-1, 1, 2).

    Also, if I write DataType.numeric I get an exception... why?

    Thanks for helping

    question 
    opened by Rubenxx00 1
  • Release the tutorial

    Release the tutorial

    Hi. This lib looks good but it is not easy to start with. For people like me that are not great at maths and like to work with data in Dart it would be great to have a tutorial explaining the features with more details and examples. This way I could figure out what some mysterious and interesting things I found in the api doc are for, like "Interpolates linearly between sourceA and sourceA with a factor t"

    enhancement help wanted 
    opened by synw 0
Owner
Lukas Renggli
Dart, Java, JavaScript, Python, Smalltalk, TypeScript
Lukas Renggli
Compress videos, remove audio, manipulate thumbnails, and make your video compatible with all platforms through this lightweight and efficient library.

video_compress Compress videos, remove audio, manipulate thumbnails, and make your video compatible with all platforms through this lightweight and ef

Jonny Borges 172 Dec 31, 2022
Manage desktop space easily with this simple Flutter app.

dspace A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this i

null 0 Nov 12, 2021
Super Fast Cross Platform Database for Flutter & Web Apps

Isar Database ?? Alpha version - Use with care. ?? Quickstart • Documentation • Sample Apps • Support & Ideas • Pub.dev Isar [ee-zahr]: River in Bavar

Isar Database 2.1k Jan 1, 2023
Fast math typesetting for the web.

KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. Fast: KaTeX renders its math synchronously and doesn't need to refl

KaTeX 16.1k Jan 8, 2023
QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter. Need help? Please do not submit an issue for a "

Yakka 612 Jan 4, 2023
Flutter Web application having splash screen and providing Web view Using web view packege.

Webview with Splash Screen in Flutter Flutter Web View With Splash Screen. Subscribe Our YouTube Channel. Visit Website Demo OutPut ?? Links Getting S

Habib ullah 1 Dec 7, 2021
A fast, minimalistic backend framework for Dart 🎯

A fast, minimalistic backend framework for Dart ?? Developed with ?? by Very Good Ventures ?? Experimental ?? Dart Frog is an experimental project und

Very Good Open Source 1.1k Jan 6, 2023
Encrypted peer-to-peer system for data security. Own data, own privacy

ESSE (Encrypted Symmetrical Session Engine) An open source encrypted peer-to-pee

CympleTech 455 Dec 26, 2022
App to learn how to code with a lot of great courses and ideas of projects to do, focused on productivity and fast learn. 💻

skoola A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this i

Batista Tony 3 Oct 29, 2021
Beautiful, minimal, and fast weather app. (Requires Android 6.0 or later)

Beautiful, minimal, and fast weather app. (Requires Android 6.0 or later)

Lacerté 104 Dec 20, 2022