GregoryConrad / mimir

⚡ Supercharged Flutter/Dart Database
https://pub.dev/packages/mimir
MIT License
129 stars 10 forks source link

Example should not depend on other packages #237

Closed kyeshmz closed 1 year ago

kyeshmz commented 1 year ago

Hi, I just looked into the example and it seems to utilize rearch, another one of your packages. I am not really in the liberty to judge how your repository should work, but it might put off people to using this package, especially while using a undocumented one.

GregoryConrad commented 1 year ago

I originally started to write the example in vanilla Flutter but quickly realized how much of a pain it is. Quickly switched it to Riverpod + hooks for a bit, but those have their own problems.

Didn't actually expect anyone to take too much of a look at the example here yet (mimir is still relatively new), but you can find all of the mimir-specific code in the first ~50 lines of code in main.dart. Not much is going on there--essentially just opening an index and then triggering a searchStream on it:

final instance = await Mimir.defaultInstance;
final index = instance.getIndex('movies');

// Add all the documents asynchronously.
await rootBundle
    .loadString('assets/tmdb_movies.json')
    .then((l) => json.decode(l) as List)
    .then((l) => l.cast<Map<String, dynamic>>())
    .then(index.setDocuments);

// ...

index.searchStream(query: query.$1)

That's about it; the rest is just UI and glue, which is out of the scope of what mimir does.

especially while using a undocumented one.

Absolutely agree, but rearch is also currently pre-release (it's the topic of my master's thesis) and I frankly didn't expect anyone to look at it yet. Essentially the only reason it's published right now is to reserve the name and also so my thesis advisor can more easily play around with it. I did jump the gun and convert this package to use rearch before formal release, but that is mostly because:

All that being said, I have full documentation coming out for it at some point within the next couple months when I release rearch, so this won't be an issue for too much longer.

Closing this as I don't plan on rewriting the example, but thank you for the feedback!

kyeshmz commented 1 year ago

More power to you, as your the author of the package

Riverpod + hooks for a bit, but those have their own problems.

Can you elaborate on this? Just wanted to know what some of the pains were

GregoryConrad commented 1 year ago

Can you elaborate on this? Just wanted to know what some of the pains were

I just made the rearch Dart implementation public (it's still pre-release though); and there is a section in the README detailing some of the issues I've found with Riverpod and hooks.