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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
Shiba-Kar opened this issue Nov 23, 2023 · 1 comment
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@Shiba-Kar
Copy link

🔖 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?

@lohanidamodar
Copy link
Member

@Meldiron I think this is related to Functions Runtimes and not SDK can you please check.

@EVDOG4LIFE EVDOG4LIFE added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants