add default value to models

This commit is contained in:
Wenqi Li 2023-06-12 00:59:30 +08:00
parent 94e39e8714
commit f72778a5d3
3 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ class Album {
mediumType = mediumType,
newest = newest,
name = json['name'],
count = json['count'];
count = json['count'] ?? 0;
/// list media in the album.
///

View File

@ -19,7 +19,7 @@ class MediaPage {
/// Creates a range of media from platform channel protocol.
MediaPage.fromJson(this.album, dynamic json)
: start = json['start'],
: start = json['start'] ?? 0,
items = json['items'].map<Medium>((x) => Medium.fromJson(x)).toList();
/// Gets the next page of media in the album.

View File

@ -49,7 +49,7 @@ class Medium {
this.width,
this.height,
this.size,
this.orientation = 0,
this.orientation,
this.mimeType,
this.duration = 0,
this.creationDate,