flutter_mock_web_server

Last updated:

0 purchases

flutter_mock_web_server Image
flutter_mock_web_server Images
Add to Cart

Description:

flutter mock web server

MockWebServer Plugin for Flutter #
A plugin that provides a mock web server to test HTTP requests and responses in Dart.
Getting Started

Import the package: import 'package:mock_web_server/mock_web_server.dart';
Create an instance of MockWebServer: var server = MockWebServer();
Start the server: await server.start();
Enqueue HTTP responses to the response queue using enqueue().
Dispatch HTTP requests using dispatchRequest() and verify the responses received.

Example
var server = MockWebServer();
await server.start();

server.enqueue(httpCode: 200, body: '{"name": "John"}');

var response = await http.get(server.url);
expect(response.statusCode, equals(200));
expect(response.body, equals('{"name": "John"}'));

server.verifyRequestCount(1);
server.verifyNoMoreRequests();
await server.shutdown();
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.