dart-archive / observe

Support for marking objects as observable, and getting notifications when those objects are mutated
https://pub.dartlang.org/packages/observe
BSD 3-Clause "New" or "Revised" License
13 stars 6 forks source link

Provide a way to import observe without mirrors #86

Open yjbanov opened 8 years ago

yjbanov commented 8 years ago

Currently, package:observe pulls in package:smoke which pulls in dart:mirrors. Flutter is allergic to dart:mirrors and crashes immediately. Please provide a way to import package:observe without mirrors.

yjbanov commented 8 years ago

/cc @matanlurey @jmesserly

sigmundch commented 8 years ago

This is just to support PathObservers, and even then package:smoke has a transformer that removes the import to mirrors automatically. It's only there if you use it without using pub-serve or pub-build.

Where is this being used from? What is it used for?

sigmundch commented 8 years ago

If you are only using ObservableList/Map then one possible short-term fix could be to refactor our code internally to not import pacakge:observe/observe.dart to get to a dependency within the package. Instead depend directly on the subset that we need. At that point, we might be able to have no dependency between ObservableLIst/Map and PathObserver, so you could import directly observable_map/observable_list.dart without an issue.

yjbanov commented 8 years ago

I am using it in a Flutter app, which doesn't use pub serve/build.

sigmundch commented 8 years ago

@yjbanov - I'm about to look at this, just wanted to confirm with you that you are not using PathObserver, but only using ObsevableList/Map?

sigmundch commented 8 years ago

actually - I'm curious also about your uses of the Observable type directly, since the default implementation based on dirty-checking depends on having mirrors as well. If it's easier, feel free to share a pointer where I can look more closely at in your code

yjbanov commented 8 years ago

This came up when I tried to get package:streamy to run in a Flutter app, so the subset we need is the one streamy uses. AFAIK, streamy does not use PathObserver.

sigmundch commented 8 years ago

thanks!

tvolkert commented 8 years ago

I just ran into this as well. Any updates?