-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into mtewani/fix-nativetojson
- Loading branch information
Showing
15 changed files
with
434 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
packages/firebase_data_connect/firebase_data_connect/example/lib/generated/list_thing.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
part of movies; | ||
|
||
class ListThing { | ||
String name = "ListThing"; | ||
ListThing({required this.dataConnect}); | ||
|
||
Deserializer<ListThingData> dataDeserializer = (String json) => | ||
ListThingData.fromJson(jsonDecode(json) as Map<String, dynamic>); | ||
Serializer<ListThingVariables> varsSerializer = | ||
(ListThingVariables vars) => jsonEncode(vars.toJson()); | ||
QueryRef<ListThingData, ListThingVariables> ref({ | ||
dynamic? data, | ||
}) { | ||
ListThingVariables vars = ListThingVariables( | ||
data: AnyValue(data), | ||
); | ||
|
||
return dataConnect.query(this.name, dataDeserializer, varsSerializer, vars); | ||
} | ||
|
||
FirebaseDataConnect dataConnect; | ||
} | ||
|
||
class ListThingThings { | ||
AnyValue title; | ||
|
||
ListThingThings.fromJson(Map<String, dynamic> json) | ||
: title = AnyValue.fromJson(json['title']) {} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['title'] = title.toJson(); | ||
|
||
return json; | ||
} | ||
|
||
ListThingThings({ | ||
required this.title, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} | ||
|
||
class ListThingData { | ||
List<ListThingThings> things; | ||
|
||
ListThingData.fromJson(Map<String, dynamic> json) | ||
: things = (json['things'] as List<dynamic>) | ||
.map((e) => ListThingThings.fromJson(e)) | ||
.toList() {} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['things'] = things.map((e) => e.toJson()).toList(); | ||
|
||
return json; | ||
} | ||
|
||
ListThingData({ | ||
required this.things, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} | ||
|
||
class ListThingVariables { | ||
AnyValue? data; | ||
|
||
ListThingVariables.fromJson(Map<String, dynamic> json) { | ||
data = json['data'] == null ? null : AnyValue.fromJson(json['data']); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
if (data != null) { | ||
json['data'] = data!.toJson(); | ||
} | ||
|
||
return json; | ||
} | ||
|
||
ListThingVariables({ | ||
this.data, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
packages/firebase_data_connect/firebase_data_connect/example/lib/generated/seed_data.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
part of movies; | ||
|
||
class SeedData { | ||
String name = "seedData"; | ||
SeedData({required this.dataConnect}); | ||
|
||
Deserializer<SeedDataData> dataDeserializer = (String json) => | ||
SeedDataData.fromJson(jsonDecode(json) as Map<String, dynamic>); | ||
|
||
MutationRef<SeedDataData, void> ref() { | ||
return dataConnect.mutation( | ||
this.name, dataDeserializer, emptySerializer, null); | ||
} | ||
|
||
FirebaseDataConnect dataConnect; | ||
} | ||
|
||
class SeedDataTheMatrix { | ||
String id; | ||
|
||
SeedDataTheMatrix.fromJson(Map<String, dynamic> json) | ||
: id = nativeFromJson<String>(json['id']) {} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['id'] = nativeToJson<String>(id); | ||
|
||
return json; | ||
} | ||
|
||
SeedDataTheMatrix({ | ||
required this.id, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} | ||
|
||
class SeedDataData { | ||
SeedDataTheMatrix the_matrix; | ||
|
||
SeedDataData.fromJson(Map<String, dynamic> json) | ||
: the_matrix = SeedDataTheMatrix.fromJson(json['the_matrix']) {} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['the_matrix'] = the_matrix.toJson(); | ||
|
||
return json; | ||
} | ||
|
||
SeedDataData({ | ||
required this.the_matrix, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
packages/firebase_data_connect/firebase_data_connect/example/lib/generated/thing.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
part of movies; | ||
|
||
class Thing { | ||
String name = "thing"; | ||
Thing({required this.dataConnect}); | ||
|
||
Deserializer<ThingData> dataDeserializer = (String json) => | ||
ThingData.fromJson(jsonDecode(json) as Map<String, dynamic>); | ||
Serializer<ThingVariables> varsSerializer = | ||
(ThingVariables vars) => jsonEncode(vars.toJson()); | ||
MutationRef<ThingData, ThingVariables> ref({ | ||
dynamic title, | ||
}) { | ||
ThingVariables vars = ThingVariables( | ||
title: AnyValue(title), | ||
); | ||
|
||
return dataConnect.mutation( | ||
this.name, dataDeserializer, varsSerializer, vars); | ||
} | ||
|
||
FirebaseDataConnect dataConnect; | ||
} | ||
|
||
class ThingThingInsert { | ||
String id; | ||
|
||
ThingThingInsert.fromJson(Map<String, dynamic> json) | ||
: id = nativeFromJson<String>(json['id']) {} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['id'] = nativeToJson<String>(id); | ||
|
||
return json; | ||
} | ||
|
||
ThingThingInsert({ | ||
required this.id, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} | ||
|
||
class ThingData { | ||
ThingThingInsert thing_insert; | ||
|
||
ThingData.fromJson(Map<String, dynamic> json) | ||
: thing_insert = ThingThingInsert.fromJson(json['thing_insert']) {} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['thing_insert'] = thing_insert.toJson(); | ||
|
||
return json; | ||
} | ||
|
||
ThingData({ | ||
required this.thing_insert, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} | ||
|
||
class ThingVariables { | ||
Optional<AnyValue> _title = | ||
Optional.optional(AnyValue.fromJson, defaultSerializer); | ||
|
||
set title(AnyValue t) { | ||
this._title.value = t; | ||
} | ||
|
||
AnyValue get title => this._title.value!; | ||
|
||
ThingVariables.fromJson(Map<String, dynamic> json) { | ||
_title.value = | ||
json['title'] == null ? null : AnyValue.fromJson(json['title']); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
if (_title.state == OptionalState.set) { | ||
json['title'] = _title.toJson(); | ||
} | ||
|
||
return json; | ||
} | ||
|
||
ThingVariables({ | ||
AnyValue? title, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
|
||
this._title = Optional.optional(AnyValue.fromJson, defaultSerializer); | ||
this._title.value = title; | ||
} | ||
} |
6 changes: 4 additions & 2 deletions
6
packages/firebase_data_connect/firebase_data_connect/example/start-firebase-emulator.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/bin/bash | ||
firebase emulators:start --project flutterfire-e2e-tests & | ||
sleep 30 | ||
# firebase emulators:start --project flutterfire-e2e-tests & | ||
# Added below to fix the e2e tests | ||
npx "firebase/firebase-tools#mtewani/dart-bugbash" emulators:start --project flutterfire-e2e-tests & | ||
sleep 45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.