PKLive on Every Saturday 6PM Now

PKLive on Every Saturday 6PM Now

#live #pklive

What is GEEK

Buddha Community

PKLive on Every Saturday 6PM Now

PKLive on Every Saturday 6PM Now

PKLive on Every Saturday 6PM Now

#live #pklive

A Simple Flutter API to Manage Rest Api Request Easily

api_manager .A simple flutter API to manage rest api request easily with the help of flutter dio.

Get started

Install

Add dependency

dependencies:
  api_manager: $latest_version

Super simple to use

import 'package:api_manager/api_manager.dart';

void main() async {
 
  ApiResponse response = await ApiManager().request(
    requestType: RequestType.GET,
    route: "your route",
  );
  print(response);
}

Config in a base manager


class ApiRepository {
  
  static final ApiRepository _instance = ApiRepository._internal(); /// singleton api repository
  ApiManager _apiManager;

  factory ApiRepository() {
    return _instance;
  }

  /// base configuration for api manager
  ApiRepository._internal() {
    _apiManager = ApiManager();
    _apiManager.options.baseUrl = BASE_URL; /// EX: BASE_URL = https://google.com/api/v1 
    _apiManager.options.connectTimeout = 100000;
    _apiManager.options.receiveTimeout = 100000;
    _apiManager.enableLogging(responseBody: true, requestBody: false); /// enable api logging EX: response, request, headers etc
    _apiManager.enableAuthTokenCheck(() => "access_token"); /// EX: JWT/PASSPORT auth token store in cache
  }
}

Examples

Suppose we have a response model like this:

class SampleResponse{
  String name;
  int id;

  SampleResponse.fromJson(jsonMap): 
        this.name = jsonMap['name'],
        this.id = jsonMap['id'];
}

and actual api response json structure is:

{
    "data": {
        "name": "md afratul kaoser taohid",
        "id": "id"
    }
}

#Now we Performing a GET request :

 Future<ApiResponse<SampleResponse>> getRequestSample() async =>
      await _apiManager.request<SampleResponse>(
        requestType: RequestType.GET,
        route: 'api_route',
        requestParams: {"userId": 12}, /// add params if required
        isAuthRequired: true, /// by set it to true, this request add a header authorization from this method enableAuthTokenCheck();
        responseBodySerializer: (jsonMap) {
          return SampleResponse.fromJson(jsonMap); /// parse the json response into dart model class
        },
      );

#Now we Performing a POST request :

 Future<ApiResponse<SampleResponse>> postRequestSample() async =>
      await _apiManager.request<SampleResponse>(
        requestType: RequestType.POST,
        route: 'api_route',
        requestBody: {"userId": 12}, /// add POST request body
        isAuthRequired: true, /// by set it to true, this request add a header authorization from this method enableAuthTokenCheck();
        responseBodySerializer: (jsonMap) {
          return SampleResponse.fromJson(jsonMap); /// parse the json response into dart model class
        },
      );

#Now er performing a multipart file upload request :

  Future<ApiResponse<void>> updateProfilePicture(
    String filePath,
  ) async {
    MultipartFile multipartFile =
        await _apiManager.getMultipartFileData(filePath);
    FormData formData = FormData.fromMap({'picture': multipartFile});

    return await _apiManager.request(
      requestType: RequestType.POST,
      isAuthRequired: true,
      requestBody: formData,
      route: 'api_route',
    );
  }

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add api_manager

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):


dependencies:
  api_manager: ^0.1.29

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:api_manager/api_manager.dart';

example/example.dart

//void main() async {
//  ApiManager _apiManager = ApiManager();
//  _apiManager.options.baseUrl = $base_url;
//  _apiManager.responseBodyWrapper("data");
//
//  ApiResponse<List<dynamic>> response = await _apiManager.request(
//    requestType: RequestType.GET,
//    route: $route,
//    responseBodySerializer: (jsonMap) {
//      return jsonMap as List;
//    },
//  );
//  print(response);
//} 

Download Details:

Author: afratul-taohid

Source Code: https://github.com/afratul-taohid/api_manager

#flutter  #restapi 

Mery tris

Mery tris

1624237200

TOP 3 ALTCOINS I'M BUYING NOW 🚀 (1000X APRIL 2021)

In this video, I’ll take a look at the some microcap altcoins using news and fundamental and technical analysis that could go 1000X soon!!
0:00 Intro
0:19 Tokenmetrics
0:50 BTC Price Analysis
2:31 KeeperDAO
5:27 Liquity
7:50 Nerve Finance
10:27 Tokenmetrics
📺 The video in this post was made by K Crypto
The origin of the article: https://www.youtube.com/watch?v=meFRDL7J68w
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #altcoins #top 3 altcoins i'm buying now #top altcoins i'm buying now #top 3 altcoins i'm buying now 🚀 (1000x april 2021)

Anastasia soda

Anastasia soda

1624323600

Do This NOW - Once You Save $1,000! DO NOT MISS!!!

Do this once you save $1,000. A step by step guide on how to prioritize spending, saving, and investing a thousand dollars
📺 The video in this post was made by Andrei Jikh
The origin of the article: https://www.youtube.com/watch?v=dOHjKLmDiqg
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #do this now - once you save $1,000! #save $1,000 #do this now

ADELAIDE JANNE

ADELAIDE JANNE

1624383000

WARNING: BITCOIN DUMPING NOW! Here is what happens NEXT!

WARNING: BITCOIN DUMPING NOW! Here is what happens NEXT!

📺 The video in this post was made by EllioTrades Crypto
️ The origin of the article: https://www.youtube.com/watch?v=CDgHL8fyO9Y

🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
⭐ ⭐ ⭐ Join to Get free ‘GEEK coin’ (GEEKCASH coin)! ☞ https://geekcash.org⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#dumping now #bitcoin #bitcoin dumping now #blockchain