Share dependencies from a package flutter - flutter

I'm developing a flutter library package. In this package I used some other dependencies, for example the url_launcher like this:
dependencies:
flutter:
sdk: flutter
url_launcher: ^5.5.0
When I import my package into the flutter app, I can't reference to url_launcher in the code until I add it into app pubspec.yaml dependencies
I wonder is there any way to share the imported dependencies from my library package so that I don't need to import again in the app?

I guess, currently there is no specified way to do this. To give you an example, I would pick this package called Chewie. What is does is:
It sits on top of a plugin called video_player, and added some cool controller.
CATCH: Since it uses video_player extensively to give away the nicer controller, however, you still need to import the video_player in your app. Otherwise, your app will crash.
WHAT YOU CAN DO?
You can mention in your documentation stating about having that dependency in the project, like the chewie plugin does. This will help people know about those things before hand, and I am sure, if your plugin is great [which is, IT SAVES TIME], people won't mind adding just another single line in their pubspec.yaml file. Otherwise, they would have done it via url_launcher but they can't. Hahaha!
Guess that will give you some clarity.
Also, do give a read on this Developing Packages

Related

Is it possible to publish your flutter app template to pub.dev

I wonder if i can publish my own flutter app template and make people use it like
flutter create example_app --template=barans_template
I see some packages do the pub global activate ..... thing, I thought maybe I can do it similar to this way but I have no idea.

I want to do something like displaying the OSS license for the Google Ads app in Flutter

I'm sorry I'm not good at English.
I'm currently developing an Android app on Flutter.The Google Ads app seems to be using Flutter and I want to do something like the license display screen for that app.
I understood how to show the license display of the Flutter package by
showLicensePage();
But I can't show the license of Java Package which flutter package depends on.
Is there any way to show the Java lib license in ShowLicensePage?
Or I should pick up each package dependencies from build.gradle file? It's very bothersome.
If Flutter uses a package called A and A uses a Java package called com.example.example (it says implementation com.example.example: 1.0.0 etc.), com.example.example depends on it. Do I have to write various packages etc.?
I want to show licenses like Google Ads app.
Please tell me how to show it.

how will changes made to a package that i depend on affect my flutter app

I just wanted to know if my flutter app depends on a certain package and if the package has made some changes in its part how will it affect my app if I am only using one version of that package
say
dependencies
flutter_eg:3.14
In the case you mentioned, nothing happens and your app continues to use that exact version.
Take a look at this to learn more about dependencies version constraints

flutter P2P communication over the network

I read this Android specific article and was wondering if some applications existed for Flutter aswell.
I know it is possible to run native code in Flutter, but I'd prefer a Dart native solution. I've noticed this package on pub.dev but I cannot make it work.
I've followed the posted example but I get a MissingPluginException for every call the plugin executes.
Yes You can do it by using this package .
https://pub.dev/packages/flutter_nearby_connections

Is there a way to open other applications in flutter

I need to be able open other apps in my flutter application
In an application i am working on I need to be able to play videos however the video_player plugin in flutter only has play and pause options and there is chewie also however we don't have the option of pausing chewie with commands , so I am thinking of opening videos through other apps like vlc,MX players, etc. How do i open these apps in flutter.
Please take a look at the open_file plugin, it supports opening most of the file including videos.
Example usage:
Specify dependency in pubspec.yaml
dependencies:
open_file: ^1.1.1
then
import 'package:open_file/open_file.dart';
OpenFile.open(your_file_path);
Hope that helps!