getQR method

Future<Response> getQR({
  1. required String text,
  2. int? size,
  3. int? margin,
  4. bool? download,
})

Get QR Code

Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.

Implementation

Future<req.Response> getQR(
    {required String text, int? size, int? margin, bool? download}) {
  final String path = '/avatars/qr';

  final Map<String, dynamic> params = {
    'text': text,
    'size': size,
    'margin': margin,
    'download': download,
    'project': client.config['project'],
  };

  params.keys.forEach((key) {
    if (params[key] is int || params[key] is double) {
      params[key] = params[key].toString();
    }
  });

  return client.call(HttpMethod.get,
      path: path, params: params, responseType: dio.ResponseType.bytes);
}