igot_http_service 0.0.1 copy "igot_http_service: ^0.0.1" to clipboard
igot_http_service: ^0.0.1 copied to clipboard

This package contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform (mobile, desktop, and browser) and supports multiple implementations wi [...]

example/example.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:igot_http_service/services/http_service.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          ElevatedButton(
              onPressed: () {
                ApiService.getApiRequest();
              },
              child: Text("Get Data"))
        ],
      ),
    );
  }
}

class ApiService {
  static Future<dynamic> getApiRequest() async {
    Response response = await HttpService.get(
        apiUri: Uri.parse("https://jsonplaceholder.typicode.com/posts"),
        ttl: Duration(minutes: 30));

    var contents = jsonDecode(response.body);
    return contents;
  }
}
1
likes
20
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

This package contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform (mobile, desktop, and browser) and supports multiple implementations with DATA Base support with respect to given TTL.

Homepage

License

unknown (license)

Dependencies

encrypt, flutter, http, path, sqflite

More

Packages that depend on igot_http_service