flutter_http_caching 0.0.8 copy "flutter_http_caching: ^0.0.8" to clipboard
flutter_http_caching: ^0.0.8 copied to clipboard

A Flutter Plugin to Handle offline API Caching using Http package and Sqflite package

example/lib/main.dart

import 'package:example/network/api_repo.dart';
import 'package:flutter/material.dart';
void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(

        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }


}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});


  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String? response;

  @override
  void initState() {
    getResponseData();
    super.initState();
  }

  getResponseData() async{
  var res =  await getNewsData();
  setState(() {
    response = res;
  });
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(child: Text(response ?? '')),
    );
  }
}
2
likes
130
points
61
downloads

Publisher

verified publishercreoit.com

Weekly Downloads

A Flutter Plugin to Handle offline API Caching using Http package and Sqflite package

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

fimber, flutter, http, http_interceptor, internet_connection_checker, path, path_provider, shared_preferences, sqflite

More

Packages that depend on flutter_http_caching