Skip to content
Snippets Groups Projects

Kat 50 add database and MyHomePage2.dart

Merged Thi Huyen Trang Nguyen requested to merge KAT-50 into master
1 file
+ 40
0
Compare changes
  • Side-by-side
  • Inline
+ 40
0
import 'package:rescueapp/database/database_provide.dart';
class Patient {
int id;
String name;
String birthday;
bool isAmbilatory;
String imagePath;
String category;
Patient({this.id, this.name, this.birthday, this.isAmbilatory, this.imagePath, this.category});
//converts to map
Map<String, dynamic> toMap() {
var map = <String, dynamic>{
DatabaseProvider.COLUMN_NAME: name,
DatabaseProvider.COLUMN_BIRTHDAY: birthday,
DatabaseProvider.COLUMN_ISAMBILATORY: isAmbilatory ? 1 : 0,
DatabaseProvider.COLUMN_IMAGEPATH: imagePath,
DatabaseProvider.COLUMN_CATEGORIE: category,
};
if (id != null) {
map[DatabaseProvider.COLUMN_ID] = id;
}
return map;
}
Patient.fromMap(Map<String, dynamic> map) {
id = map[DatabaseProvider.COLUMN_ID];
name = map[DatabaseProvider.COLUMN_NAME];
birthday = map[DatabaseProvider.COLUMN_BIRTHDAY];
isAmbilatory = map[DatabaseProvider.COLUMN_ISAMBILATORY] == 1;
imagePath = map[DatabaseProvider.COLUMN_IMAGEPATH];
category = map[DatabaseProvider.COLUMN_CATEGORIE];
}
}
\ No newline at end of file
Loading