appwrite / appwrite/sdk-for-dart

🚀 Feature: context.res.send(); , 1st parameter accepts only a String .

Open
#50 1 comment 0 reactions 1 assignee Claimed by @Meldiron View on GitHub
bug
Dominant language
Dart
Stars
118
Forks
22
Avg merge
8h 16m
Merged PRs (30d)
3

Description

### 🔖 Feature description

Allow context.res.send(); 1st parameter accepts String and bytes so as to send Uint8List as data.
I am trying to send ```Uint8List``` as the 1st parameter getting the below error

```dart
Future main(final context) async {
final pdf = PDF();
final order = FakeOrder();
var fakeOrder = order.createFakeOrder();
context.log(fakeOrder.toJson().toString());
final Uint8List? bytes = await pdf.createAndSave(fakeOrder);

if (bytes != null) {
context.log('PDF created.');
context.log(bytes);

return context.res.send(bytes, 200, {'Content-Type': 'application/pdf'});
}

return context.error("Someting gone wrong");
}
```

```cmd
type 'Uint8List' is not a subtype of type 'String' of 'body'
#0 main (package:generate_pdf/main.dart)

#1 Future.any.onValue (dart:async/future.dart:615)

```

### 🎤 Pitch

Allow to accept 1st parameter as dynamic

OLD
```dart

context.res.send(, , Map);

```
NEW

```dart

context.res.send(, , Map);

```

### 👀 Have you spent some time to check if this issue has been raised before?

- [X] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [X] I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.