CodingAleCR / http_interceptor

A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.
MIT License
134 stars 67 forks source link

Consider(?) removing flutter/foundation.dart dependency #38

Closed jrastic closed 3 years ago

jrastic commented 4 years ago

Hi!

Currently, code that uses the library needs flutter run instead of dart run. On dart run I get:

...
Error: Not found: 'dart:ui'
export 'dart:ui' show VoidCallback;

If run with flutter run all is good. Seems that dart:ui is not available in normal dart run...

Went through the code and it seems that if I remove flutter/foundation.dart imports all is well. Also, no @required is then available but that seems small price to pay, IMO at least.

What do you say, would you consider this change in your code?

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.62. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

CodingAleCR commented 4 years ago

Hi, it definitely looks like something I would consider. I also want to expand the plugin to be able to use it with Flutter Web, it was initially conceived as a small plugin for Flutter Mobile but it has grown into much more than I expected. Just as a curiosity, is the project you are working on purely dart or is it something Flutter related as well?

jrastic commented 4 years ago

Project that I'm working on will eventually be a flutter mobile application, but I'm trying to divide project in separate reusable modules - for example API access with JWT authentication and token refreshing...

It would be nice to have an option to test API layer of the app without the need to run it on an emulator - just with basic dart execution.

CodingAleCR commented 4 years ago

So your are using dart packages to separate your code right? I am working on making the library more testable (if that's even a word) and what you are saying matches with my view of the library as well. I will plan out ahead and see where it fits best to add this to the library, I think we might even be able to use another plugin called meta to replace the usage of foundation. What do you think about this idea?

bluemix commented 4 years ago

I hope there are updates to this issue. I keep getting errors on a dart project.

Screen Shot 2020-09-05 at 12 38 28
CodingAleCR commented 4 years ago

So sorry to hear that @bluemix . I will work on it this week for sure and probably patch release if I find it to be quick enough, otherwise will mark it here for everyone to look at.

CodingAleCR commented 3 years ago

@bluemix @jrastic I've added a feature branch that removes flutter/foundation.dart dependencies. It would be great if you could double-check that this would fix the issues that you were both having. Thanks in any case for posting the issue and sorry for getting to it so late.

CodingAleCR commented 3 years ago

I can confirm that this issue is fixed in the branch and will be available soon as a patch release. Thanks for notifying the issue and hopefully it improves the usage of the plugin.

CodingAleCR commented 3 years ago

This will be fixed in version 0.3.3. Closing the issue.