offline_store_upload 0.0.2 copy "offline_store_upload: ^0.0.2" to clipboard
offline_store_upload: ^0.0.2 copied to clipboard

To store api calls locally and upload when needed.

offline_store_upload: Stores api calls locally and uploads when needed. This package can be used in apps where offline functionality is needed.

Usage #


import 'package:offline_store_upload/offline_store_upload.dart'; 
  
/// Store API 
MaterialButton(
  child: Text('Store Api'),
  onPressed: () {

    /// initialize a list
    List<OfflineStoreApi> data = [];

    /// add api calls to the list

    data.add(
      OfflineStoreApi(
        api_body: {
          "name": "Flutter",
          "age": 30,
        },
        api_url: url,
        api_type: APITYPE.POST,
      ),
    );

    /// add api calls to the list

    data.add(
      OfflineStoreApi(
        api_body: {
          "name": "Dart",
          "age": 55,
        },
        api_url: url,
        api_type: APITYPE.PUT,
      ),
    );

    /// upload when needed

    OfflineStoreUpload().addData(api_data: data);
  },
),

/// Upload Api
MaterialButton(
  child: Text('UPLOAD API'),
  onPressed: () {

    /// Use this function to upload the locally stored api when needed
    OfflineStoreUpload().upload(token: '');
  },
),

1
likes
140
points
33
downloads

Publisher

unverified uploader

Weekly Downloads

To store api calls locally and upload when needed.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

dio, flutter, flutter_lints, path_provider, pretty_dio_logger

More

Packages that depend on offline_store_upload