okmock

Last updated:

0 purchases

okmock Image
okmock Images
Add to Cart

Description:

okmock

OkMock #
Dio interceptor for mocking HTTP request in Flutter
Prerequisite #

gadb

Quick Start #
Flutter Side #

Add OkMock as your dependency

dependencies:
okmock: "0.0.1"
copied to clipboard

Add OkMock as Dio interceptor

dio = Dio();
dio.interceptors.add(OkMock.createDefault(dio));
copied to clipboard
Desktop Side #

After install gadb, create mock file in json or yaml

{
"path": "*google.com*",
"method": "GET",
"body": {
"message": "hello mock"
}
}
copied to clipboard

Run gadb mock -f <file>

That's it! Now every time a request is matching the path and method, your request will return body
Example #
You can also check out the flutter app example
License #
MIT @ Esa Firman

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.