getQR method

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

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<Uint8List> getQR({
  required String text,
  int? size,
  int? margin,
  bool? download,
}) async {
  const String apiPath = '/avatars/qr';

  final Map<String, dynamic> params = {
    'text': text,
    'size': size,
    'margin': margin,
    'download': download,

    'project': client.config['project'],
  };

  final res = await client.call(
    HttpMethod.get,
    path: apiPath,
    params: params,
    responseType: ResponseType.bytes,
  );
  return res.data;
}