downloadSelectedIconsFont method
Implementation
@override
Future<Uint8List?> downloadSelectedIconsFont(
Package package, {
String? apiKey,
}) async {
try {
final result = await _http.send(
'/api/v1/parse-svgs',
headers: {
if (apiKey == null)
'Authorization': 'Bearer ${(await _authService.session)?.idToken}'
else
'api-key': apiKey
},
method: HttpMethod.post,
autoDecodeReponse: false,
body: {
'fontName': package.fontFamily,
'data': package.icons
.where((e) => e.selected)
.map(
(e) => {
'id': e.id,
'svg': e.toStringNormalized(),
},
)
.toList(),
},
parser: (_, bytes) => (bytes as Uint8List).buffer.asUint8List(),
);
return result.when(
success: (_, bytes) => bytes,
failed: (_, __) => null,
);
} catch (e, s) {
print(e);
print(s);
}
return null;
}