getUri method

Uri getUri(
  1. {required String path,
  2. Map<String, dynamic>? queryParameters,
  3. bool? addUserAgentParameters,
  4. String? userInfo,
  5. String? forcedHost}
)

Returns a OFF uri with the OpenFoodAPIConfiguration specified settings

Typical use-case of "addUserAgentParameters = false" is for other request than GET, e.g. POST or MULTIPART, where we add the user agent parameters in another part of the code.

Implementation

Uri getUri({
  required final String path,
  final Map<String, dynamic>? queryParameters,
  final bool? addUserAgentParameters,
  final String? userInfo,
  final String? forcedHost,
}) =>
    Uri(
      scheme: scheme,
      host: forcedHost ?? host,
      path: path,
      queryParameters: addUserAgentParameters ?? defaultAddUserAgentParameters
          ? HttpHelper.addUserAgentParameters(queryParameters)
          : queryParameters,
      userInfo: userInfo,
    );