http_pref 0.0.1

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 #


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);
      return open_spaces;


dynamic uploadForm(Map<String, dynamic> formData, List<OpenSpaceFile> files) async {
    var openSpaceFormData =
        OpenSpaceFormData(formFields: formData, files: files);
    String response = await
        url: report, openSpaceFormData: openSpaceFormData);
    return response;

0.0.1 #

  • TODO: Describe initial release.


http_pref_example #

Demonstrates how to use the http_pref plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  http_pref: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:http_pref/repository/base_api_provider.dart';
import 'package:http_pref/repository/base_cache_provider.dart';
import 'package:http_pref/repository/base_repo.dart';
import 'package:http_pref/repository/base_repository.dart';
import 'package:http_pref/repository/data/file.dart';
import 'package:http_pref/repository/data/form_data.dart';
import 'package:http_pref/repository/helper/preferences.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health issues and suggestions

Document public APIs. (-1 points)

52 out of 52 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/repository/base_repo.dart.

Run flutter format to format lib/repository/base_repo.dart.

Format lib/repository/base_repository.dart.

Run flutter format to format lib/repository/base_repository.dart.

Format lib/repository/helper/preferences.dart.

Run flutter format to format lib/repository/helper/preferences.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.0+2 0.12.0+4
shared_preferences ^0.5.3+4 0.5.6+1
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.11 1.14.12
flutter_web_plugins 0.0.0
http_parser 3.1.3
meta 1.1.8
path 1.6.4
pedantic 1.9.0
shared_preferences_macos 0.0.1+4
shared_preferences_platform_interface 1.0.1
shared_preferences_web 0.1.2+3
sky_engine 0.0.99
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies