Dart • Built on top of sqlite • Provides Type Safety, Stream Query, Type Safe SQL, • It is Flexible: let’s you write queried in both [SQL & Dart] • It support Filter, Order, Joins on Multiple Tables • Moor Is just Room spelled backward. (Room we are using in Android)
• Moor provides Tables, queries, migration, IDE for SQL, complex filters. • Moor helps you keep your database code simple and easy to understand. • Identify or catches the error and provides the solution • Moor is fast like FLUTTER. • Moor works on Android, iOS, macOS, Windows, Linux, and the web. • Moor is stable and well tested with a wide range of unit and integration tests. It powers the production of Flutter apps. • Moor also uses Sqlite Packages • Moor itself uses SQL as its backend so in flutter we can directly create a Table using Dart.
core package defining most apis • sqlite3_flutter_libs: Ships the latest sqlite3 version with your Android or iOS app. • path_provider and path: Used to find a suitable location to store the database. Maintained by the Flutter and Dart team • moor_generator: Generates query code based on your tables • build_runner: Common tool for code-generation, maintained by the Dart team
Extending Table 2) IntColumn & TextColumn is DataType 3) Rest of The Things will handle Build_Runner for Creating Table import 'package:moor_flutter/moor_flutter.dart'; part 'moor_database.g.dart'; class Orders extends Table { TextColumn get price => text()(); IntColumn get id => integer().autoIncrement()(); TextColumn get productName => text()(); } @UseMoor(tables: [Orders]) class AppDatabase{ } @override Set<Column> get primaryKey => {id, productName};
3) set different column name from variable name 4) Allow nullable values 5) Custom Table/Column name More On Creating Table String get tableName => 'categories'; IntColumn get parentCategory => integer().named('parent')();