http_pref 0.0.1
http_pref: ^0.0.1

Flutter Android iOS web

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

http_pref #

Making your app offline ready. Uses http for network request and shared prefences for cache

Description #

Extend to BaseRepository and get all your GET request cached in using shared preferences.

Basic Usage #

GET #

class OpenSpaceRepository extends BaseRepository {
  bool doesNotContain = false;

  Future<List<OpenSpace>> fetchOpenSpace({forceLoadFromCache = true}) {
    return fetchItem(get_open_space, forceLoadFromCache: forceLoadFromCache)
        .then((response) {
      var json = jsonDecode(response);
      List<OpenSpace> openSpaces = mapJsonToOpenSpace(json);

      return openSpaces;
    });
  }

  List<OpenSpace> mapJsonToOpenSpace(json) {
      List<OpenSpace> open_spaces = (json as List).map((i) {
        return OpenSpace.fromJson(i);
      }).toList();
      return open_spaces;
    }

POST #

dynamic uploadForm(Map<String, dynamic> formData, List<OpenSpaceFile> files) async {
    var openSpaceFormData =
        OpenSpaceFormData(formFields: formData, files: files);
    String response = await baseNetworkProvider.post(
        url: report, openSpaceFormData: openSpaceFormData);
    return response;
  }
0
likes
90
pub points
0%
popularity

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

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

nishon@naxa.com.np

License

MIT (LICENSE)

Dependencies

flutter, http, shared_preferences

More

Packages that depend on http_pref