Flutter network manager package.

Overview

Features

With Network Manager, you can now easily manage your internet requests, send and receive data.

Usage

Set Base URL

Settings Base URL -> NetworkManager("https://jsonplaceholder.typicode.com/",debugMode: true);

Set Request Methods:

.setGET()  => "GET"
.setPOST() => "POST"
.setPUT() => "PUT"
.setDELETE() => "DELETE"

### Set TimeOuts:

.setSendTimeout(1000) => Default Value 3000.

### Set setReceiveTimeOut:

.setReceiveTimeOut(1000) => Default Value 3000.

### Set setQueryParameters:

    .setQueryParameters({"name":"example"})

### Set setHeader:

    .setHeader({"Content-Type":"example"})

#### Set setBody:

    .setBody({"Content-Type":"example"})

### Set setContentType:

    .setContentType("multipart-form")

#### Set setPath:

    .setPath("api/v1/login")

### Set execute:

    .execute<T extends BaseResponseModel, K>(
      T responseModel)

      T extends  => Your Decode Model
      T responseMode => Your Decode Model
      K => Show View Model, ExampleModel, List<ExampleModel>

home_services.dart

import 'package:network_manager/Network/Error/network_error.dart';
import 'package:network_manager/Network/Result/network_result.dart';
import '../../../client/network_client.dart';
import '../model/home_model.dart';

class HomeServices {
  Result<List<HomeModel>, NetworkError> result = const Result.success([]);

  Future<void> getHomeList() async {
    Future.delayed(const Duration(seconds: 1));
    final response = await NetworkClient.instance.networkManager
        .setGET()
        .setPath("posts")
        .execute<HomeModel, List<HomeModel>>(HomeModel());
    result = response;
  }
}

home_model.dart

import 'package:network_manager/Network/Interface/model_interface.dart';

class HomeModel extends BaseResponseModel {
  HomeModel({
    this.userId,
    this.id,
    this.title,
    this.body,
  });

  int? userId;
  int? id;
  String? title;
  String? body;

  factory HomeModel.fromJson(Map<String, dynamic> json) => HomeModel(
        userId: json["userId"],
        id: json["id"],
        title: json["title"],
        body: json["body"],
      );

  Map<String, dynamic> toJson() => {
        "userId": userId,
        "id": id,
        "title": title,
        "body": body,
      };

  @override
  fromJson(Map<String, dynamic> json) {
    return HomeModel.fromJson(json);
  }
}

home_screen.dart

import 'package:flutter/material.dart';

import '../services/home_services.dart';

class HomeScreen extends StatelessWidget {
  HomeScreen({Key? key}) : super(key: key);
  final HomeServices homeServices = HomeServices();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text("Example Network Manager"),
        ),
        body: FutureBuilder(
          future: homeServices.getHomeList(),
          builder: (context, snapshot) => homeServices.result.when(
            success: (data) {
              return ListView.builder(
                itemBuilder: (context, index) => ListTile(
                  title: Text(data[index].title ?? ""),
                  subtitle: Text(data[index].body ?? ""),
                ),
                itemCount: data.length,
              );
            },
            failure: (error) {
              return Text(error.toString());
            },
          ),
        ));
  }
}

network_client.dart

import 'package:network_manager/Network/network_builder.dart';

class NetworkClient {
  static final NetworkClient instance = NetworkClient();
  final NetworkManager networkManager = NetworkManager("https://jsonplaceholder.typicode.com/",debugMode: true);
}

ScreenShot

You might also like...

Meme Network is the creative powerhouse that supercharges your Meme projects with the World's First Layer 1 solution in the Cosmos Ecosystem.

Meme Network is the creative powerhouse that supercharges your Meme projects with the World's First Layer 1 solution in the Cosmos Ecosystem.

MEME Chain How to Join MEME Mainnet Recommended system setup 4 core CPU Memory: 4GB Disk: 100GB Ubuntu 20.04 Meme Validator Node Snapshot & State-Sync

Oct 26, 2022

Utility Manager Flutter Application is made with Flutter and Supabase which allows user to add task, set remainder to the task, set color to separate tasks and it allows to add URL with URL's informations.

Utility Manager Flutter Application is made with Flutter and Supabase which allows user to add task, set remainder to the task, set color to separate tasks and it allows to add URL with URL's informations.

Utility Manager Flutter Application! Utility Manager Flutter Application is made with Flutter and Supabase which allows user to add task, set remainde

Jan 6, 2022

AuthPass - Password Manager based on Flutter for all platforms. Keepass 2.x (kdbx 3.x) compatible.

AuthPass - Password Manager based on Flutter for all platforms. Keepass 2.x (kdbx 3.x) compatible.

AuthPass.app - Open Source Password Manager for mobile and desktop AuthPass - Password Manager based on Flutter for all platforms. Keepass 2.x (kdbx 3

Jan 5, 2023

A task manager built with Flutter, Serverless, Postgres, Firebase

A task manager built with Flutter, Serverless, Postgres, Firebase

Tasky Mobile App A project management mobile app This project is an implementation of a Design i found on uigaints.com by Ashish Dhakal. The Backend w

Dec 31, 2022

A simple, cross-platform password manager created with Flutter.

A simple, cross-platform password manager created with Flutter.

PassMan PassMan Logo © 2021 by Yash Ahir is licensed under CC BY-NC 4.0 A simple, cross-platform password manager created with Flutter. How to run thi

Dec 14, 2022

Simple student record manager app for learning flutter basics

Simple Student Record Manager Simple student record manager app for learning flutter basics integrated with Django REST API (refer Generic-Student-API

Oct 31, 2022

Plant Manager is an application that was developed on Rocketseat NLW5 with React Native but was rebuilt using Flutter.

Plant Manager is an application that was developed on Rocketseat NLW5 with React Native but was rebuilt using Flutter.

Technologies | Project | Layout | License 🚀 Technologies This project was developed with the following technologies: Flutter 💻 Project Plant Manager

Aug 11, 2021

Flutter Theme Manager with Abstract Factory Design

extheme A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Dec 23, 2022

Password Manager Created Using Flutter And SQLite

Password Manager Created Using Flutter And SQLite

Dec 24, 2022
Releases(flutter)
Owner
Sercan KAYA
iOS Developer @ Flutter
Sercan KAYA
Flutter Package Manager

Flutter Package Manager Flutter Package Manager, powerfull package management via CLI, add/search/top/favorite packages! Install > pub global activate

César Ferreira 3 Dec 1, 2021
CLI package manager and template for Flutter

Slidy CLI package manager and template generator for Flutter. Generate Modules, Pages, Widgets, BLoCs, Controllers, tests and more. Slidy supports mob

Flutterando 768 Dec 20, 2022
⚡⚡ flutter mobile dapp to register/mint domain names (.voltz) on the polygon blockchain network (mumbai)

open-name-service connecting to wallet registering a domain on the network fetching address by domain name & viewing domain on opensea testnet .voltz

Chinyeaka Chinonso 10 Dec 11, 2022
Communication Network between Patient & Doctor

DrComm X-Legion-Coders - DrComm - Health Project is made under Scaler HackX hackathon Problem Statement Improve medical and emergency communication So

Ayush Kejariwal 3 Dec 30, 2021
Meow App with animations, beautiful UI and network call

Meow app Meow App with animations, beautiful UI and network call. Each time you tap a new gif loads. Used API : (https://cataas.com/cat/gif) Screensho

null 1 Nov 2, 2021
Plugin to checker data connection network.

ci_connectivity OBS: For now we don't have IOS support Getting Started Flutter plugin for checking network connection. It is not just checking if you

Lucas Firmino 0 Nov 23, 2021
Instagram is a free, online photo-sharing application and social network platform

Instagram is a free, online photo-sharing application and social network platform that was acquired by Facebook in 2012. Instagram allows users to edit and upload photos and short videos through a mobile app.

Behruz Hurramov 4 Dec 6, 2022
Minimal zenon.network JS SDK

znn.js znn.js is a community-backed javascript SDJ for the zenon.network project. The implementation is based on the official Dart SDK. Minimal requir

Alien Valley 10 May 19, 2022
Showwcase is a professional network built for developers to connect, build community, and find new opportunities.

Showwcase Generated by the Very Good CLI ?? Showwcase is a professional network built for developers to connect, build community, and find new opportu

Luis Ciber 4 Jan 13, 2022
A cryptocurrency, crypto-currency, or crypto is a digital currency designed to work as a medium of exchange through a computer network that is not reliant on any central authority

A cryptocurrency, crypto-currency, or crypto is a digital currency designed to work as a medium of exchange through a computer network that is not reliant on any central authority, such as a government or bank, to uphold or maintain it.

Prashant Kumar Singh 10 Dec 3, 2022