Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to send bites along with String #212

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Shiba-Kar
Copy link

@Shiba-Kar Shiba-Kar commented Nov 24, 2023

馃敄 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

Future<dynamic> 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");
}
type 'Uint8List' is not a subtype of type 'String' of 'body'
#0      main (package:generate_pdf/main.dart)
<asynchronous suspension>
#1      Future.any.onValue (dart:async/future.dart:615)
<asynchronous suspension>

馃帳 Pitch

Allow to accept 1st parameter as dynamic

OLD

context.res.send(<String>, <int>, Map<String,dynamic>);

NEW

context.res.send(<dynamic>, <int>, Map<String,dynamic>);

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants