Using package that is dependency of another local package - flutter

Let's say I have few flutter apps and I want all of them to load common local dependency(package) via path.
Like this:
The reasoning behind is straightforward - to have shared classes/helpers that used by all or most of flutter apps.
Now the core_flutter package have it's own packages as well.
Like this for example:
Now the question. Is it correct to use core_flutter dependencies inside apps that depend on it? Because it's kind of desired behaviour to share core_flutter packages across apps that depend on it.
For example if I need to use provider in my app_one that depends on flutter_core. Is it fine to use it without adding provider into app_one pubspec.
I've tested it already and it work.
The question though is it good practice / reliable.
The only issue right now I've noticed thad IDE won't autocomplete classes and imports in app_one that part of dependencies of core_flutter.

Related

Is there a way to export Flutterflow code to flutter?

I'm using the free version of Flutterflow and I'm trying to copy paste the code manually (as exporting requires premium). However, I'm skeptical because some import statements require flutterflow packages, which I can't directly download. Is this going to be a problem? Is there any other way?
Unfortunately, these files are 100% needed in order to build your flutter app. It is part of the business model of FlutterFlow to hide the source code for these modules.
In the free version of FlutterFlow, it is not possible to view or download these dependencies. So sadly, there is no comfortable way. I assume that FlutterFlow would intentionally like to keep you away from reproducing these dependencies in order to grow their business model.
During my research, I stumbled upon the GitHub project FlutterFlow/flutterflow-ui which claims to provide the missing dependencies. You can install it via the pub.dev package flutterflow_ui.
You could install it by adding this to your pubspec.yaml
flutterflow_ui: ^0.1.0+4
However, I have no information on the authenticity and license of this package. So be careful when adding it to your project. You will also need to replace all the relative imports ../flutter_flow/.. after installation.

How to organize dart files inside packages in flutter

I'm new at programming using flutter and I'd like to develop a small project containing a few screens: Login, Home, Settings, User, PurchaseHistory, etc.
I need to organize the code inside packages so that it can readable easily.
If I develop an Android App, I'd create some packages: model, activity, fragment, util, etc. If I create a LoginActivty, I'd put it inside activity package. If I create a User model, I'd put it inside model package. And so on.
So If I develop a flutter project, where am I supposed to put all of the files I create so far?
For now I've created only model package.
First of all, in Flutter we don't deal with activities or fragments directly, that is a naming convention from Android itself.
There are many options to architect your app and organize your folders. I wouldn't say that there is a holy grail solution. So you have to try some of them and see the best fit for you.
At the end of this article, I show an option to a folder structure when working with flavors, like this:
But there are plenty of others, so I recommend you to see how some of the GitHub projects are organized, a good way to start is having a look at the projects from this repository. Especially the 'Open Source Apps' section.
I'm currently working on a project that follows an approach like you described.
I don't know if it's the better structure, but it works really nice for me.
\lib
\-model
\-api
\-bloc
\-widgets (commom components)
\-exceptions
\-config (config classes/files like routes, theme, specific settings for each environment - dev, production, test)
\-views
\-login
\-home
\-user_profile
\-...
\-main.dart
----- EDITED -----
After work for almost a year with Flutter, I've tested some different structures, and there's one in particular that's really nice and provides an amazing organization...
Take a look at slidy, the following image represents the kind of organization it provides. More details in the package description.

What is the difference between package and project in Eclipse?

I don't really understand what the point of having a package is. Every Class is kept in a different file, so what's the point of using different packages in a single project?
An Eclipse project has nothing to do with Java. It is a feature of Eclipse to organize and configure your different projects.
A Java package is a language feature of Java. You can use them to structure your project and control visibility between different classes. This becomes necessary even in relatively small projects, which already might have a few hundred classes. I suggest you look for a basic tutorial on what a Java package is and what it can do. To give you a headstart, here is what the official documentation has to say about the purpose of bundling related classes in a package:
You should bundle these classes and the interface in a package for several reasons, including the following:
You and other programmers can easily determine that these types are related.
You and other programmers know where to find types that can provide graphics-related functions.
The names of your types won't conflict with the type names in other packages because the package creates a new namespace.
You can allow types within the package to have unrestricted access to one another yet still restrict access for types outside the package.
Packages are useful for many things. For example, you could store a set of files that do a given task TASK in a package named task.
Packages are a way for developers to find easily and quickly a file, knowing what the role of the file is.
Whenever your project starts growing, packages are essential.
See this lesson for basic understanding of packages utility.

How to find a class in a list of Nuget packages

My team is using more and more NuGet packages as a way to break the system into smaller pieces and share things between parts. We have adopted a sort of SRP principle for packaging, creating small and hopefully cohesive packages that do just one thing (logging, auditing, security stuff, etc).
Ideally they should be so cohesive and self-contained that it would be straightforward to know what package will contain what you need. However we are not yet there and sometimes is difficult to know what package you should add to access some functionality.
My question is: is there any way to publish and navigate package content information? Like, for instance, in MSDN you can see what assembly contains a class. Would it be possible to know something like that, at the package level?
Thanks.
It's a very localised version, but there is a package searcher for the ASP.NET 5 packages hosted on NuGet. It might be possible to host a version that looks at a wider scope at some point.
https://packagesearch.azurewebsites.net/
The closest functionality I can think of is implemented in ReSharper. However it can only search the packages in nuget.org(closed issue on GitHub). Since packages don't expose type info, JetBrains built a custom index and that's the only data source it can query.

Inherit .sbt files

I have many small Scala applications and I would like a central place to manage versions of common dependencies.
I know I can set up a Build.scala file and define multiple projects. I used to have that, but not all of these applications are related in that sense. They just happen to share a common software architecture.
How do I achieve this with SBT? Currently I'm managing multiple .sbt files that I batch update (like dependencies.sbt, common.sbt etc.).
My initial approach was to start writing a plugin, but I got stumped along the way with getting dependencies working within the plugin.
I wanted to collect plugin settings and build settings. But I never got one plugin to depend on a set of other plugins.
Anyone tried this before, how do I manage central application profiles (both plugins and settings)?
Do you mean different applications? You can then just put your settings into global.sbt. You can look for more detailed description here