40 lines
914 B
Dart
40 lines
914 B
Dart
import 'package:sqflite/sqflite.dart';
|
|
|
|
const String Service_tableName = 'services';
|
|
const String Service_columnId = 'id';
|
|
const String Service_columnArticul = 'articul';
|
|
const String Service_columnName = 'name';
|
|
const String Service_columnPrice = 'price';
|
|
const String Service_columnCategoryId = 'category_id';
|
|
const String Service_columnEan = 'ean';
|
|
|
|
class Service {
|
|
int id;
|
|
int articul;
|
|
String name;
|
|
double price;
|
|
|
|
Map<String, dynamic> toMap() {
|
|
var map = <String, dynamic>{
|
|
Service_columnArticul: articul,
|
|
Service_columnName: name,
|
|
Service_columnPrice: price,
|
|
};
|
|
if (id != null) {
|
|
map[Service_columnId] = id;
|
|
}
|
|
return map;
|
|
}
|
|
|
|
Service();
|
|
|
|
Service.fromMap(Map<String, dynamic> map) {
|
|
id = map[Service_columnId];
|
|
articul = map[Service_columnArticul];
|
|
name = map[Service_columnName];
|
|
price = map[Service_columnPrice]?.toDouble();
|
|
}
|
|
|
|
}
|
|
|