WikiResponse.fromMap constructor
WikiResponse.fromMap(
- Map<String, dynamic> map
)
Implementation
factory WikiResponse.fromMap(Map<String, dynamic> map) {
Map? path = map['query']?['pages'];
String? key = path?.keys.first;
return WikiResponse(
pageId: path?[key]?['pageid'],
title: path?[key]?['title'],
description: path?[key]?['description'],
extract: path?[key]?['extract'],
langlinks: path?[key]?['langlinks']
?.map<Tuple2<String, String>>(
(e) => Tuple2(e['lang'] as String, e['*'] as String),
)
?.toList(),
rawResponse: map,
success: path?[key]?['title'] != null,
);
}