image method

void image(
  1. Pattern url,
  2. List<int> png
)

Answers an image request with real bytes — a PNG a fixture already holds, or one scenarioPlaceholderPng made.

Sugar over stub with the content type filled in, because an image is the request a scenario stubs most often and getting the type wrong is a decode failure two layers away from the line that caused it.

Implementation

void image(Pattern url, List<int> png) =>
    stub('GET', url, body: png, contentType: 'image/png');