jifalops / async_resource Goto Github PK
View Code? Open in Web Editor NEWAutomatically cache network resources and use them when offline. Interface with local resources on any platform.
License: MIT License
Automatically cache network resources and use them when offline. Interface with local resources on any platform.
License: MIT License
Am using a flutter package async_resource. in my Mobile App using flutter, I can't really understand the documentation please there a parameter maxAge: Duration(minutes: 60) //Please what does this mean, Do they mean the duration for fetching and caching data? Or duration for the data to be expired?
Secondly, The url parameter: //Must it be .json url? because am trying to send data using POST(which means that I don't have .json url)
Here is my code, It neither create a file nor cache the data from the server
Future<HttpNetworkResource<Question>> fetchQuestion({String subject, int lastId})async{
await Future.delayed(Duration(seconds: 1));
var map = new Map<String, String>();
map["subject"] = subject;
map["lastid"] = lastId.toString();
final path = (await getApplicationDocumentsDirectory()).path;
final myDataResource = HttpNetworkResource<Question>(
url: Base_URL().getQuestion,
headers: map,
parser: (contents) => Question.fromJson(contents),
cache: FileResource(File('$path/JambQtz$subject.json')),
maxAge: Duration(minutes: 1),
strategy: CacheStrategy.cacheFirst,
);
return myDataResource;
}
Future<HttpNetworkResource<Question>> question = HttpAPI().fetchQuestion(subject: 'physics', lastId: 1);
question.then((v){
v.isExpired.then((b){
print('Expired $b');
});
print('Location: ${v.location}');
print(v.headers);
print(v.hashCode);
});
High im getting a dependency error, we are using rxdart
version ^0.23.1
, but your plugin depends on rxdart ^0.18.0
.
Error:
Because async_resource >=0.1.4 depends on rxdart ^0.18.0 and hiro_insurance depends on rxdart ^0.23.1, async_resource >=0.1.4 is forbidden.
Whenever I add this library to my pubspec.yaml my flutter map is not working anymore in web mode. It's not showing any map tiles anymore.
I double and tipple check that this is the only change I made but somehow only adding it is enough to break my code.
Even more strangely, after removing it again I get can compiler error complaining about a missing rxdart. When I add this instead It still does not work but when I remove it again afterwards it compiles again and it works again as well.
I first encountered this in async_resource_flutter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.