jsonstreamreader 1.1.4 copy "jsonstreamreader: ^1.1.4" to clipboard
jsonstreamreader: ^1.1.4 copied to clipboard

outdated

This project processes local and remote json files/sources by splitting it into smaller chunks, with automatic garbage collecting.

example/main.dart

import 'package:jsonstreamreader/jsonstreamreader.dart';
import 'dart:async';

void main() {
  RemoteSource f =
      new RemoteSource('https://jsonplaceholder.typicode.com/posts');
  f.setBody({'userId': '1'});
  Streamer s = new Streamer(f, chunksize: 100);
  //Not Ready to start reading so I use hault
  Reader r = new Reader(s, combine: 1)..hault();
  r.trailing((dynamic value, String key) {
    print("key is ${key} and value is ${value}");
  });
  r.progress((p) {
    print(p);
  }).done(() {
    print('Completed');
  }).fail((error) {
    print(error);
  });
  new Timer(new Duration(seconds: 1), () {
    //start reading
    r.begin();
  });
  FileState.notinuse.listen((d) {
    print('this file is free to delete');
    print(d);
  });
  r.onpause((ReaderState state) {
    print(state.toString());
  });

  ///Pause the reader
  new Timer(new Duration(seconds: 3), () {
    r.pause().then((ReaderState state) {
      //here you code store state.toString() in a file or just resume
      new Timer(new Duration(seconds: 3), () {
        r.resume();
      });
    });
  });
  f.downloaded.listen((onData) {
    //File will always be download before parsing is done
    //but parsing is started as soon as data is available,i.e while the file is downloading
    print('File has been downloaded');
  });
  f.download();
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

This project processes local and remote json files/sources by splitting it into smaller chunks, with automatic garbage collecting.

Homepage

License

unknown (LICENSE)

Dependencies

flutter, heavylist, path, path_provider

More

Packages that depend on jsonstreamreader