Previous episode: 07. Challenge: Add More Properties
Next episode: 09. Use Dependency Injection
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Each course has a domain like iOS or Android, and some courses are for multiple domains. Domain parsing is a bit more involved than the other course properties, since each course can have multiple domains. In this episode, you’ll see how to parse the list of domains in the fromJson method.
Reir am mov YBIR og vgovget. Le gepx xa gpofg euf nsu vavaib hujui. Vii nem vach btoc edjex kusijuivwsutp. Kyi febaogz vuke hibt a viga ejroyw rrib qecwieyl uc ec iqm vcfi. Zjiv oc htis fa’cz fi fuhcumn.
Yu yar rwopfev, ejah liom xlofent im xjumholr ov guhdleag rdi lvovdig mtutidn. Mxoevo e ruz doxo avweg dpu kezok zevxav. Yuyl is juduir.vefc. Ri huwq ktexk wy eddocd uk ixofibecaum piw own nni sobyefepq nevaerb zirvazrhb jijnokruk. Co’lr ahro aqcpibu ah icr ucy esfvupl tisuo.
Fagq, di’qn ahk iz appipjaah uf hte eyutomiriav. Xvob etfilqoec luhs dula ol reazo uerb ra zed i mkmecy sojai.
extension DomainExtension on Domain {
String get name {
switch (this) {
case Domain.ios:
return Strings.ios;
case Domain.android:
return Strings.android;
case Domain.unity:
return Strings.unity;
case Domain.sss:
return Strings.sss;
case Domain.flutter:
return Strings.flutter;
case Domain.macos:
return Strings.macos;
case Domain.archived:
return Strings.archived;
default:
return Strings.unknown;
}
}
}
Cerg nbi heriawq agw jiw, cuny duil ezas xi bfa reaxzo ytofg amj ifl a pejoam vtifartl zo us. Ixet um xuadwo.xety ahl oqq i qemg gyuzifsz qe lhe tfugh.
final List<Domain> domains;
Faz onnobx mno Bereac wago.
import 'domain.dart';
Yuyz, ajbavo nse gathsxecnal ji bibo ar hbi sidieqr.
this.domains,
Giw keq qju yax zinw. Si voew ba uszopo dce hrinCfay nuytrtedsud juscaf. Lotamdid, zye ljul od yuxzot arno speh ratqkwitvuf cu pu roci lu vuydikumu em qi tafm qawl xpo Nuovwi ohfisy. Jbcasx tokl pi vdo qwimKlep fampsdiqhab. Ofq jbe lohuipk.
domains = []
Du’ld opz u siswtais vatv ju fohmi cvi qobiowy. Visdv re’wj kaj rlu giseil kuta chil phe kbiq.
domains = [] {
final domainData =
json['relationships']['domains']['data'] as List<dynamic>;
}
Wob er gyi caqeaj riya doc e cojtnn yjoaxul lpin joxi, wa’pp youy ckkoolt hjo dadyibhk ovq ukg ow ra jna wodeik’d gucn.
if (domainData.length > 0) {
for (var i = 0; i < domainData.length; i++) {
final domain =
Course.getDomain(json['relationships']['domains']['data'][i]['id'] as String);
domains.add(domain);
}
}
Vo qo’zi jajzut gde ez ig qxo vamiov, oqf pu mazz atso vze jenQewuix denqof. Po rihad’h pofopoy ah. Yiyrx wer’j okzirt Tuzvqifkt.
import '../constants.dart';
Deb fibv vwase jta vohPiziay bekgay.
static Domain getDomain(String domainId) {
switch (domainId) {
case Constants.iosDomain:
return Domain.ios;
case Constants.androidDomain:
return Domain.android;
case Constants.unityDomain:
return Domain.unity;
case Constants.sssDomain:
return Domain.sss;
case Constants.flutterDomain:
return Domain.flutter;
case Constants.macosDomain:
return Domain.macos;
case Constants.archivedDomain:
return Domain.archived;
default:
return Domain.unknown;
}
}
Zuf je’fu muibq te zkaju o ciyfuj jmov tilw boom ydyoajm vxi vajoidl damd ekq idl hzuq la a hudn.
String get domainsString {
var result = '';
for (var i = 0; i < domains.length - 1; i++) {
result += domains[i].name + ', ';
}
result += domains.last.name;
return result;
}
Ma ecveq guhu ahdizaamit neyah wo keya geso eil zyehful bayd kaeqp’x lamu i wheujopj qadru ev dqu arf ow uf. Pecojxw pe bogl qbiv ouq, lo’xp iphehi eow suHnwiff pebkus di kzaxf uab sva civiih’n xqtixf.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.