Advertisement
alvinvin00

disaster.dart

Mar 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.97 KB | None | 0 0
  1. import 'package:firebase_database/firebase_database.dart';
  2.  
  3. class Disaster{
  4.   String _title;
  5.   String _content;
  6.   String _photo;
  7.   String _userId;
  8.   String _location;
  9.   String _disasterId;
  10.   int _timestamp;
  11.  
  12.  
  13.   Disaster(
  14.       this._title,
  15.       this._content,
  16.       this._photo,
  17.       this._userId,
  18.       this._location,
  19.       this._disasterId,
  20.       this._timestamp);
  21.  
  22.   String get title => _title;
  23.   String get content => _content;
  24.   String get photo => _photo;
  25.   String get userId => _userId;
  26.   String get location => _location;
  27.   String get disasterId => _disasterId;
  28.   int get timestamp => _timestamp;
  29.  
  30.   Disaster.fromSnapshot(DataSnapshot snapshot){
  31.     _title = snapshot.value['title'];
  32.     _content = snapshot.value['content'];
  33.     _photo = snapshot.value['photo'];
  34.     _userId = snapshot.value['userId'];
  35.     _location = snapshot.value['location'];
  36.     _disasterId = snapshot.value['disasterId'];
  37.     _timestamp = snapshot.value['timestamp'];
  38.   }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement