Skip to content

Commit

Permalink
rfac: minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
JideGuru committed Dec 26, 2023
1 parent 82fc1f4 commit 2a3be4e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
24 changes: 12 additions & 12 deletions lib/src/common/domain/models/category_feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ class Feed {
: null;
if (json['entry'] != null) {
final String t = json['entry'].runtimeType.toString();
if (t == 'List<dynamic>' || t == '_GrowableList<dynamic>') {
try {
entry = <Entry>[];
json['entry'].forEach((v) {
entry!.add(Entry.fromJson(v as Map<String, dynamic>));
});
} else {
} catch (_) {
entry = <Entry>[];
entry!.add(Entry.fromJson(json['entry'] as Map<String, dynamic>));
}
Expand Down Expand Up @@ -324,9 +324,9 @@ class Entry {
? Id.fromJson(json['id'] as Map<String, dynamic>)
: null;
if (json['author'] != null) {
if (json['author'].runtimeType.toString() == 'List<dynamic>') {
try {
author = Author1.fromJson(json['author'][0] as Map<String, dynamic>);
} else {
} catch (_) {
author = Author1.fromJson(json['author'] as Map<String, dynamic>);
}
}
Expand All @@ -350,24 +350,24 @@ class Entry {
? Id.fromJson(json['summary'] as Map<String, dynamic>)
: null;
if (json['category'] != null) {
final String t = json['category'].runtimeType.toString();
if (t.toLowerCase().contains('list')) {
category = <Category>[];
category = <Category>[];
try {
json['category'].forEach((v) {
category!.add(Category.fromJson(v as Map<String, dynamic>));
});
} else {
category = <Category>[];
} catch (_) {
category!.add(
Category.fromJson(json['category'] as Map<String, dynamic>),
);
}
}
if (json['link'] != null) {
link = <Link1>[];
json['link'].forEach((v) {
link!.add(Link1.fromJson(v as Map<String, dynamic>));
});
try {
json['link'].forEach((v) {
link!.add(Link1.fromJson(v as Map<String, dynamic>));
});
} catch (_) {}
}
schemaSeries = json[r'schema$Series'] != null
? SchemaSeries.fromJson(json[r'schema$Series'] as Map<String, dynamic>)
Expand Down
22 changes: 11 additions & 11 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -1131,10 +1131,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
state_notifier:
dependency: transitive
description:
Expand All @@ -1147,10 +1147,10 @@ packages:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
stream_transform:
dependency: transitive
description:
Expand Down Expand Up @@ -1187,10 +1187,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
time:
dependency: transitive
description:
Expand Down Expand Up @@ -1315,10 +1315,10 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
web_socket_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -1368,5 +1368,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=3.1.0 <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.13.0"

0 comments on commit 2a3be4e

Please sign in to comment.