RequestContext constructor

RequestContext({
  1. Map<String, String>? headers,
  2. dynamic body,
  3. String? userId,
  4. required String ipAddress,
  5. required String deviceId,
  6. DateTime? timestamp,
  7. Map<String, dynamic>? metadata,
})

Creates a request context. ipAddress and deviceId are required; everything else is optional and defaults sensibly (e.g. timestamp defaults to the current UTC time).

Implementation

RequestContext({
  Map<String, String>? headers,
  this.body,
  this.userId,
  required this.ipAddress,
  required this.deviceId,
  DateTime? timestamp,
  Map<String, dynamic>? metadata,
})  : headers = headers ?? const {},
      timestamp = timestamp ?? DateTime.now().toUtc(),
      metadata = metadata ?? <String, dynamic>{};