getUrl method
Implementation
String getUrl(Map<dynamic, dynamic> params, Map<dynamic, dynamic> extra) {
final path = fullPath;
var start = 0;
final buffer = StringBuffer();
int i = 0;
for (var m in _matchs) {
if (m.start > start) {
buffer.write(path.substring(start, m.start));
}
final key = _params[i];
final data = NRouterJsonTransfrom.encode(params[key]);
buffer.write(data);
start = m.end;
i += 1;
}
if (start < path.length) {
buffer.write(path.substring(start));
}
if (extra.isNotEmpty) {
buffer.write('?');
bool isFirst = true;
for (var MapEntry(:key, :value) in extra.entries) {
if (!isFirst) {
buffer.write('&');
} else {
isFirst = false;
}
final data = NRouterJsonTransfrom.encode(value);
buffer.write('$key=$data');
}
}
return buffer.toString();
}