aProblem function

Problem aProblem({
  1. ErrorPortal portal = ErrorPortal.localError,
  2. String id = 'entity-not-found',
  3. String version = 'v1',
  4. String title = 'Entity not found',
  5. int status = 404,
  6. bool recoverable = false,
  7. String? detail,
  8. String? instance,
  9. Map<String, Object?> data = const <String, Object?>{},
})

Builds a valid Problem, defaulting to a single-source type URI.

When type is omitted, the URI is minted by problemTypeUri so test problems never hand-format the template either.

Implementation

Problem aProblem({
  ErrorPortal portal = ErrorPortal.localError,
  String id = 'entity-not-found',
  String version = 'v1',
  String title = 'Entity not found',
  int status = 404,
  bool recoverable = false,
  String? detail,
  String? instance,
  Map<String, Object?> data = const <String, Object?>{},
}) {
  return Problem(
    type: problemTypeUri(portal: portal, version: version, id: id),
    title: title,
    status: status,
    detail: detail,
    instance: instance,
    recoverable: recoverable,
    data: data,
  );
}