push method

Future<bool> push()

Implementation

Future<bool> push() async {
  if (_queued.isEmpty) return false;
  if (_pushingToIpfs) return false;
  if (!online) return false;
  _pushingToIpfs = true;

  final goe = _queued.keys
      .where((element) =>
          !!_inserted.containsKey(element) && !!_failed.contains(element))
      .toList();
  if (goe.isEmpty) return false;

  final xdat = _queued[goe.first];
  final xx = goe.first;

  return await pushToPinataIPFS(
          _pinata_api_key, _pinata_secret_api_key, xdat!)
      .then((value) {
    if (value.isNotEmpty) {
      _queued[xx] != null;
      _pushingToIpfs = false;
      return true;
    }
    _failed.add(xx);
    _pushingToIpfs = false;
    return false;
  });
}