Languages lastcommit Issues

The plug-in built to simplify internet requests.

Getting started

Depend on it

Add this to your package's pubspec.yaml file:

       pop_network: <latest-version>

Install it You can install packages from the command line:

with Flutter:

  $ flutter pub get


It is possible to perform an initial configuration using the pop_network.config function. This function should be used when starting to build your application with some custom settings.

void main() {
  await pop_network.config(baseUrl: "");
  runApp(const MyApp());

Where you can add a base url or just not configure and pass the url in Enpoint. For more information visit the Contribution Guide

final endpoint = Endpoint(
  suffixPath: ''

The suffixPath can be used this way or being concatenated with a base url that is configured in the execution of the application, it doesn't have to be at the beginning but it is good to avoid errors.

void main() {
  await PopNetwork.config(baseUrl: "");
  runApp(const MyApp());

final endpoint = Endpoint(
  suffixPath: 'suffix/path'

result path:

Some other base settings can be done like setting intectors, setting default header, etc. More details in pop_network config Guide

When the split settings are completed, just call the api:

final result = await ApiManager.request();


final endpoint = Endpoint(
  suffixPath: 'suffix/path'

final result = await ApiManager.requestApi(
  endpoint: endpoint,

It is possible to check if your device is connected to the internet using ConnectionChecker;

final conection = await ConnectionChecker.isConnectedToInternet();

I see the gif of the operation below:


If you want to see a usage in a simple way, go to /example folder.

It is also possible to make the request directly to the mock file that is being mapped to the functionality with ApiManager.requestMock. For more information, go to the documentation of the Mock.


Additional information

For contributes:

  • Fork this repository;
  • Create a new branch to develop your feature: git checkout -b my-feature;
  • Commit your changes: git commit -m 'feat: my new feature';
  • Push to your branch: git push origin my-feature.
  • Open a pull request for your code to be evaluated.
  • For more information visit the Contribution Guide

To help maintain the chosen pattern we also create a file which is called before every commit. This file will format and pinpoint (if present) errors in the codestyle of your code. To enable this you must first copy it to git's hooks folder. If you are developing on macOS, go to the root of the project and run the command below:

cp pre-commit .git/hooks/pre-commit

After this step, it is necessary to give permission for the file to be executed. Just follow the following command:

chmod +x .git/hooks/pre-commit