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

Making your app offline ready. Uses http for network requests and sharedprefences for cache

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:http_pref_example/endpoints.dart';
import 'package:http_pref_example/repository/post_repository.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String response = "";

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: FutureBuilder<String>(
          future: postRepository.getPosts(getPost),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              return Text("${snapshot.data}");
            } else {
              return Center(
                child: CircularProgressIndicator(),
              );
            }
          },
        ),
      ),
    );
  }
}
0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Making your app offline ready. Uses http for network requests and sharedprefences for cache

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, http, shared_preferences

More

Packages that depend on http_pref