Skip to content

Commit

Permalink
Update List usage
Browse files Browse the repository at this point in the history
* Replace [] initialization deprecated to List<MyClass>.empty(growable: true);
  • Loading branch information
Jeasmine committed Apr 27, 2021
1 parent c139643 commit 241f275
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/create_notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class OSCreateNotification extends JSONStringRepresentable {

// adds buttons
if (this.buttons != null) {
var btns = [];
var btns = List<Map<String, dynamic>>.empty(growable: true);
this.buttons!.forEach((btn) => btns.add(btn.mapRepresentation()));
json['buttons'] = btns;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class OSNotification extends JSONStringRepresentable {
}

if (json.containsKey('buttons')) {
this.buttons = [];
this.buttons = List<OSActionButton>.empty(growable: true);
var btns = json['buttons'] as List<dynamic>;
for (var btn in btns) {
var serialized = btn.cast<String, dynamic>();
Expand Down

0 comments on commit 241f275

Please sign in to comment.