car_dao.dart 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import 'package:flutter_provider_demo/model/car_model.dart';
  2. class CarDao {
  3. /// get cars from sqlite
  4. static Future<List<CarModel>> getCars() async {
  5. return [
  6. CarModel(id: 1, brand: "大众", type: "朗逸"),
  7. CarModel(id: 2, brand: "大众", type: "帕萨特"),
  8. CarModel(id: 3, brand: "大众", type: "迈腾"),
  9. CarModel(id: 4, brand: "大众", type: "途观", start: true),
  10. CarModel(id: 5, brand: "大众", type: "途昂"),
  11. CarModel(id: 6, brand: "大众", type: "途岳", start: true),
  12. CarModel(id: 7, brand: "大众", type: "途铠"),
  13. CarModel(id: 8, brand: "大众", type: "途锐", start: true),
  14. CarModel(id: 9, brand: "大众", type: "途昂X"),
  15. CarModel(id: 10, brand: "大众", type: "途岳X", start: true),
  16. CarModel(id: 11, brand: "大众", type: "途铠X"),
  17. CarModel(id: 12, brand: "大众", type: "途观L"),
  18. ];
  19. }
  20. /// add car to sqlite
  21. /// @param car
  22. /// @return
  23. /// @throws Exception
  24. static Future<int> addCar(CarModel car) async {
  25. return 0;
  26. }
  27. /// delete car from sqlite
  28. /// @param car
  29. /// @throws Exception
  30. static Future<bool> deleteCar(CarModel car) {
  31. return Future.value(true);
  32. }
  33. }