File tree Expand file tree Collapse file tree 3 files changed +3
-26
lines changed
packages/firebase_database/firebase_database Expand file tree Collapse file tree 3 files changed +3
-26
lines changed Original file line number Diff line number Diff line change @@ -100,28 +100,10 @@ void testsMain() {
100
100
.child ('ordered/one' )
101
101
.get ();
102
102
expect (dataSnapshot, isNot (null ));
103
- expect (dataSnapshot.key, 'one' );
103
+ expect (dataSnapshot! .key, 'one' );
104
104
expect (dataSnapshot.value['ref' ], 'one' );
105
105
expect (dataSnapshot.value['value' ], 23 );
106
106
});
107
-
108
- test ('DataSnapshot.exists is false for no data' , () async {
109
- final dataSnapshot = await FirebaseDatabase .instance
110
- .reference ()
111
- .child ('a-non-existing-reference' )
112
- .get ();
113
-
114
- expect (dataSnapshot.exists, false );
115
- });
116
-
117
- test ('DataSnapshot.exists is true for existing data' , () async {
118
- final dataSnapshot = await FirebaseDatabase .instance
119
- .reference ()
120
- .child ('ordered/one' )
121
- .get ();
122
-
123
- expect (dataSnapshot.exists, true );
124
- });
125
107
});
126
108
}
127
109
Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ class Event {
29
29
/// A DataSnapshot contains data from a Firebase Database location.
30
30
/// Any time you read Firebase data, you receive the data as a DataSnapshot.
31
31
class DataSnapshot {
32
- DataSnapshot ._(this .key, this .value) {
33
- exists = value != null ;
34
- }
32
+ DataSnapshot ._(this .key, this .value);
35
33
36
34
factory DataSnapshot ._fromJson (
37
35
Map <Object ?, Object ?> _data,
@@ -57,9 +55,6 @@ class DataSnapshot {
57
55
58
56
/// Returns the contents of this data snapshot as native types.
59
57
final dynamic value;
60
-
61
- /// Ascertains whether the value exists at the Firebase Database location.
62
- late bool exists;
63
58
}
64
59
65
60
class MutableData {
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ class Query {
82
82
Future <DataSnapshot > once () async => (await onValue.first).snapshot;
83
83
84
84
/// Gets the most up-to-date result for this query.
85
- Future <DataSnapshot > get () async {
85
+ Future <DataSnapshot ? > get () async {
86
86
final result = await _database._channel.invokeMethod <Map <dynamic , dynamic >>(
87
87
'Query#get' ,
88
88
< String , dynamic > {
You can’t perform that action at this time.
0 commit comments