-
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.
- Loading branch information
Showing
4 changed files
with
144 additions
and
34 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
97 changes: 97 additions & 0 deletions
97
packages/firebase_data_connect/firebase_data_connect/example/lib/generated/list_persons.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,97 @@ | ||
part of movies; | ||
|
||
class ListPersons { | ||
String name = "ListPersons"; | ||
ListPersons({required this.dataConnect}); | ||
|
||
Deserializer<ListPersonsResponse> dataDeserializer = (String json) => | ||
ListPersonsResponse.fromJson(jsonDecode(json) as Map<String, dynamic>); | ||
|
||
QueryRef<ListPersonsResponse, void> ref() { | ||
return dataConnect.query(this.name, dataDeserializer, null, null); | ||
} | ||
|
||
FirebaseDataConnect dataConnect; | ||
} | ||
|
||
class ListPersonsPeople { | ||
late String id; | ||
|
||
late String name; | ||
|
||
late List<ListPersonsPeopleDirectedMovies> directed_movies; | ||
|
||
ListPersonsPeople.fromJson(Map<String, dynamic> json) | ||
: id = json['id'], | ||
name = json['name'], | ||
directed_movies = (json['directed_movies'] as List<dynamic>) | ||
.map((e) => ListPersonsPeopleDirectedMovies.fromJson(e)) | ||
.toList() {} | ||
|
||
// TODO(mtewani): Fix up to create a map on the fly | ||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['id'] = id; | ||
|
||
json['name'] = name; | ||
|
||
json['directed_movies'] = directed_movies.map((e) => e.toJson()).toList(); | ||
|
||
return json; | ||
} | ||
|
||
ListPersonsPeople({ | ||
required this.id, | ||
required this.name, | ||
required this.directed_movies, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} | ||
|
||
class ListPersonsPeopleDirectedMovies { | ||
late String title; | ||
|
||
ListPersonsPeopleDirectedMovies.fromJson(Map<String, dynamic> json) | ||
: title = json['title'] {} | ||
|
||
// TODO(mtewani): Fix up to create a map on the fly | ||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['title'] = title; | ||
|
||
return json; | ||
} | ||
|
||
ListPersonsPeopleDirectedMovies({ | ||
required this.title, | ||
}) { | ||
// TODO(mtewani): Only show this if there are optional fields. | ||
} | ||
} | ||
|
||
class ListPersonsResponse { | ||
late List<ListPersonsPeople> people; | ||
|
||
ListPersonsResponse.fromJson(Map<String, dynamic> json) | ||
: people = (json['people'] as List<dynamic>) | ||
.map((e) => ListPersonsPeople.fromJson(e)) | ||
.toList() {} | ||
|
||
// TODO(mtewani): Fix up to create a map on the fly | ||
Map<String, dynamic> toJson() { | ||
Map<String, dynamic> json = {}; | ||
|
||
json['people'] = people.map((e) => e.toJson()).toList(); | ||
|
||
return json; | ||
} | ||
|
||
ListPersonsResponse({ | ||
required this.people, | ||
}) { | ||
// 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