toUrl method

String toUrl()

Create the url for the current Avataaar data with all parameters needed.

Implementation

String toUrl() {
  //https://avataaars.io required that the first letter must be capitalised. fixed keys and added the capitalization to value
  final params = _pieceEntries.map((it) {
    final key = it.key[0].toLowerCase() + it.key.substring(1);
    final value = it.value[0].toUpperCase() + it.value.substring(1);
    return '$key=$value';
  }).join('&');
  return '$baseUrl/?$params';
}