mock_image_http.dart 556 Bytes
Newer Older
1 2 3 4 5
import 'dart:async';
import 'package:flutter/foundation.dart' show ValueGetter;
import 'package:http/http.dart' as http;
import 'package:http/testing.dart' as http;

6
import '../../../packages/flutter/test/painting/image_data.dart';
7 8 9 10 11 12 13 14 15

// Returns a mock HTTP client that responds with an image to all requests.
ValueGetter<http.Client> createMockImageHttpClient = () {
  return new http.MockClient((http.BaseRequest request) {
    return new Future<http.Response>.value(
      new http.Response.bytes(kTransparentImage, 200, request: request)
    );
  });
};