api method
Implementation
Uri api(String method, [Map<String, dynamic> params = const {}]) {
Map<String, String> queryParams =
params.map((key, value) => MapEntry(key, value.toString()));
bool hasParams = queryParams.length > 0;
if (SSL) {
Uri? uriResult;
if (hasParams) {
uriResult = Uri.https(url, 'api/$method', queryParams);
} else {
uriResult = Uri.https(url, 'api/$method');
}
return uriResult;
} else {
return Uri.http(url, 'api/$method', queryParams);
}
}