shelf icon indicating copy to clipboard operation
shelf copied to clipboard

Why is the parameter "context" of Response of Map<String, Object> type? Instead of Map<String, dynamic>?

Open qcks opened this issue 3 years ago • 3 comments

  Response.ok(
    Object? body, {
    Map<String, /* String | List<String> */ Object>? headers,
    Encoding? encoding,
    Map<String, Object>? context,
  })

qcks avatar Oct 31 '22 06:10 qcks

We didn't think it was important to support null, I guess. I don't remember

Is there a reason you want dynamic? Or are you just curious?

On Sun, Oct 30, 2022, 23:17 卡特皮勒 @.***> wrote:

Response.ok( Object? body, { Map<String, /* String | List<String> */ Object>? headers, Encoding? encoding, Map<String, Object>? context, })

— Reply to this email directly, view it on GitHub https://github.com/dart-lang/shelf/issues/303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEFCQCPIKVZS33I2DMO4TWF5P6XANCNFSM6AAAAAARSYAYIY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kevmoo avatar Oct 31 '22 06:10 kevmoo

      return Response.ok('ok', context: {"user": user.toJson()});

      return Response.ok('ok', context: user.toJson());

    ......
///UserBean 
  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    return data;
  }

@kevmoo

qcks avatar Nov 01 '22 06:11 qcks

😋I think this is elegant

qcks avatar Nov 01 '22 06:11 qcks