operator []= method

void operator []=(
  1. String key,
  2. String value
)

Set session value by key

Example:

server.get('/api/set/:item', (ctx) async {
  final Session session = await ctx.session;
  session['item'] = ctx.pathParams.item;
  // ...
});

Implementation

operator []=(String key, String value) {
  _data[key] = value;
  needsUpdate = true;
}