-
-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discussion] App modularization #2591
Comments
I don't know of a better way to do this if we don't have official flutter support. I mean we could ask if there is a maybe undocumented way or if it's on the todo list but if not I'm fine with doing it this way. |
Hi @g123k! If I understand well:
I'm a bit puzzled because somehow we manage to override the app version from the So let's assume points 1 and 2 above are correct. For the moment What if we said that
I don't know if that would work. My point here is to have a minimal impact on the existing code. So basically, @g123k could you test if we could have
|
So you're right. Let's we rename the current For the tests, no need actually, because I'm 100% sure (I've done it in previous projects). |
Hi @g123k! There are some things I would like to clarify before you start.
=> Please do keep the same name. That was the only important point of my previous comment. We need it to keep the code history (at least I do).
Very surprising indeed. That would entail that if I use a pub.dev package that uses its own assets, I would have to rename those package asset files? Obviously some misunderstanding: we need to clarify this. Especially when #2306 has nothing to do with it. In short, as a test, you would just have to
The next step would be
abstract class AbstractScanner {
void helloWorld();
}
class FdroidScanner extends AbstractScanner {
@override
void helloWorld() => print('hi this is Fdroid here');
}
|
If you download a dependency from pub.dev and this dependency have some assets, you have to specify the
No, because of the package thing |
@g123k I have to test that. Sounds very strange. I'll keep you posted by tomorrow. |
If you want to better understand why, just decompile an Android APK and you will thus understand that |
@g123k We're probably not talking about the same thing. If I use a package that I find in pub.dev, and if this package contains assets, I do not have to change that package assets, do I? Probably the source of our misunderstanding is what we want to do in the old package and the new packages. Still in my tests. |
Let me rephrase everything. Let's say we have:
When in your base app, you say Image.asset(path), it automatically implied package = base_app Now, Cupertino_icons have its own font asset, but let's say it's an image. If I say Image.asset(path) => 404, because the asset is in a subfolder called cupertino_icons and NOT in the base app. So if I sum up, in the code (wherever you are), if you want to access an asset that is defined outside the main app, you have to specify the package. That's what we have to do for smoothie, since the base app will now become a "dependency". |
I never will. What you imply is that a dependency does not have the same access to its own assets, depending on whether the dependency is a dependency to another package or is independent. That's possible, but that would be very surprising to me. |
No, what I just say, is:
From the Flutter docs:
|
@g123k My tests today:
@g123k What are your thoughts about localization? |
Regarding localization, can we keep everything in a single file ? |
You mean, a unique file for all the flutter apps, or a unique file for all languages? |
@g123k Regarding assets (again), I've just a look at pub.dev packages that contain assets (not that easy to find). Image.asset(
'assets/flags/${_filteredCountries[index].code.toLowerCase()}.png',
package: 'intl_phone_field',
width: 32,
) Same with https://pub.dev/packages/country_pickers and https://pub.dev/packages/country_list_pick. OK, you win :) We'll have to check if all our asset cases (json, svg, png, ogg, pem, txt, ttf) can be dealt with with that additional But as I said, the localizations part looks more problematic. |
I think the best solution would be to just avoid the problem as we are now in a stage where there are not many people with the same problems. Preferably by somehow running the generation step before flutter run does it's job like its possible in JS with scripts in the counterpart to darts The closest thing I could find is this: For this to work we would still need a command which generates the translations files without running Edit: |
Also for other assets there seem to be workarounds https://stackoverflow.com/questions/54740732/how-to-add-assets-in-flutter-package-plugin-development
or
|
@teolemon @g123k @M123-dev You guys realize that ALL that heavy non-sense could be prevented if we were just able to comment and uncomment the # smooth_mlkit: ### to be commented/uncommented
# path: ../../../smooth_mlkit ### to be commented/uncommented
smooth_zxing: ### to be commented/uncommented
path: ../../../smooth_zxing ### to be commented/uncommented In both And in smooth_app's // import 'package:smooth_mlkit/smooth_mlkit.dart'; ### to be commented/uncommented
import 'package:smooth_zxing/smooth_zxing.dart'; ### to be commented/uncommented
final ScanInterface scanInterface = ScanInterface(); Et voilà. |
That should be doable without that much work automatically |
I think we can close this issue as it's now implemented |
Hi everyone,
We now have a few pending issues regarding:
Dart (and Flutter) doesn't allow us to have dynamic dependencies, like Gradle would on Android.
The only solution is to have an architecture that looks like this:
To achieve this kind of architecture, Flutter forces us to specify the name of the
package
for each asset we want.That's why, we have to change the current "app" to be the
common
module. This will force us to provide a package for all assets we want to access. (That's what I've done in #2320, but not only)Here is the plan:
package
everywhere in thecommon
module + create an app to test the architectureIf you have any suggestion, feel free to ask!
The text was updated successfully, but these errors were encountered: