evant / streamqflite Goto Github PK
View Code? Open in Web Editor NEWflutter reactive stream wrapper around sqflite inspired by sqlbrite
License: MIT License
flutter reactive stream wrapper around sqflite inspired by sqlbrite
License: MIT License
Hi @evant
Thank you for making this library.
Just wondering when I make a query then subscribe to the stream, then I cancel the subscription is the query then no longer observed for changes.
Just wanted to make sure that my SQL queries aren't accumulating and then all being watched for changes even when there are no subscribers.
Can you please update the dependency to sqflite: ^1.0.0
First at all, thx for the amazing lib...
I would like to know how can I stub to test my functions, I'm trying to mock it but I don't know how to do it
First I wanna to test this call
Stream<List<Customer>> fetchCustomers() => db.createQuery('customers')
.mapToList(_mapCustomer);
I'm trying this:
test("it returns a list with fake customer", () async {
when(mockDatabase.createQuery('customers')
.mapToList((row) => Customer.fromDB(row)))
.thenAnswer((_) => Stream.fromIterable([fakeCustomer].cast()));
Stream<List<Customer>> subject = CustomersCache(mockDatabase)
.fetchCustomers();
expect(subject, emits([fakeCustomer]));
});
I think that I need to mock createQuery
but how can I do?
Update required to sqflite 1.1.1 to remove dependency on deprecated Android support library.
Is there a generic map function I can use with this library?
My app uses BuiltList instead of List so I want to do something like this
Stream<BuiltList<T>> mapToBuiltList<T>(T mapper(Map<String, dynamic> row)) {
return _source.asyncMap((query) => query()).map((rows) {
var result = BuiltList<T>().toBuilder();
for (final row in rows) {
result.add(mapper(row));
}
return result.build();
});
}
I think the library should expose a generic map function so that any data structure can be used.
_source.asyncMap((query) => query())
is the part that could be exposed.
For some reason I cant push a pull request, but here is the update of the project with Dart 3 incompatible fixed and null safety:
Hey,
I just wanted to know whether you're still interested in maintaining this project.
I had the same idea for a library like this this weekend but saw that yours is existing. The only thing missing is Dart 2 support.
If you're still interested, I would try to submit a PR where all libraries are updated and Dart 2 is supported.
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.