joaopaulofcc

Untitled

Nov 11th, 2020
510
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/widgets.dart';
  2. import 'controls/databaseClient.dart';
  3. import 'models/dog.dart';
  4.  
  5. void main() async {
  6.   WidgetsFlutterBinding.ensureInitialized();
  7.  
  8.   DatabaseClient db = new DatabaseClient();
  9.   await db.open();
  10.  
  11.   Dog cachorro1 = Dog(id: 1, name: 'Rex', age: 35);
  12.   await db.insertDog(cachorro1);
  13.   print(await db.getDogs());
  14.  
  15.   Dog cachorro2 = Dog(id: 2, name: 'Bretas', age: 2);
  16.   await db.insertDog(cachorro2);
  17.   print(await db.getDogs());
  18.  
  19.   cachorro2 = Dog(id: cachorro2.id, name: 'Bretas o Dog', age: cachorro2.age + 1);
  20.   await db.updateDog(cachorro2);
  21.   print(await db.getDogs());
  22.  
  23.   await db.deleteDog(2);
  24.  
  25.   print(await db.getDog(1));
  26. }
RAW Paste Data