igot_http_service_helper 0.2.0 copy "igot_http_service_helper: ^0.2.0" to clipboard
igot_http_service_helper: ^0.2.0 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_helper/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;
  }
}
0
likes
0
points
305
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

crypto, flutter, hive, hive_flutter, http, path

More

Packages that depend on igot_http_service_helper