Is there any way to remove Transitive dependency in flutter? - flutter

I have a very frustrating problem in which two different packages define same function name showModalBottomSheet
I was(am) using this awesome flutter package
https://pub.dev/documentation/country_code_picker which has a transitive dependency modal_bottom_sheet that defines showModalBottomSheet.
After upgrading to last flutter version 3.7 I cannot run my app because flutter material defines itself another showModalBottomSheet function. This creates compilation errors because doesn't know which one to use from the 2 different imports.
Error (Xcode): ../../../.pub-cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/bar_bottom_sheet.dart:102:13: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
Is there a way to to configure pubspec and say it to ingore https://pub.dev/packages/modal_bottom_sheet from all the transitive dependencies ?
That way I avoid the issue and the app will run fine.
PS: I looked into other Newer libraries for country picker but they did not support all the features of the existing ones so best and shortest solution would be to ignore(not install) the package above

It is a known issue. A fix has been merged. You can either wait for the package author to publish an update, or you could try using the package from git:
modal_bottom_sheet:
git:
url: https://github.com/jamesblasco/modal_bottom_sheet.git
ref: main
Note: According to OP (via comment), the above did not work, but the following does:
dependency_overrides:
modal_bottom_sheet:
git:
url: https://github.com/danReynolds/modal_bottom_sheet.git
path: modal_bottom_sheet

Related

How to fix transitive depedency generated by depedebot

We have enabled depedebot alert on our repository. But depedebot is not opening new PR for some of vulnebrites.
For example :
Below is one of alert I see
`
The latest possible version that can be installed is 2.4.2 because of the following conflicting dependencies:
zip-folder#1.0.0 requires lodash#~2.4.1 via archiver#0.11.0
zip-folder#1.0.0 requires lodash#~2.4.1 via a transitive dependency on zip-stream#0.4.1
The earliest fixed version is 4.17.21.
`
But Zip-folder is not updated on npm repo so far as fix on lodash was relased 9 year ago i.e;v 1.1.1 but loadash latest version 4.17.21 and it's using v 1.1.0
As zip depedency is transitive should I update v1.1.1 in my package.json manually. Will it override the vesion used by zip or there is some alternative of this approach?

Flutter Conflict: geolocator: ^5.1.4+1 and google_maps_flutter: ^0.5.21+7 generate dependency conflict

Currently I'm doing a Flutter application witch uses:
geolocator: ^5.1.4+1
google_maps_flutter: ^0.5.21+7
When I declare both dependencies in "pubspec.yaml" it get a conflict
"FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:preDebugBuild'.
Android dependency 'com.google.android.gms:play-services-tasks' has different version for the compile (16.0.1) and runtime (17.0.0) classpath. You should manually set the same version via DependencyResolution"
I've tryied also by editing gradle.properties with:
android.useAndroidX=true
android.enableJetifier=true
And in "app/build.gradle" added the dependencies as classpath and/or api as needed:
com.google.android.gms:play-services-tasks
Is anyone facing same issue? In case you solved it, what have you done to solve it?
I had exactly the same problem, though using google_maps_flutter0.5.21+8.
I added for every error message the following line to android/app/build.gradle under dependencies. Look then like the following:
dependencies {
...
implementation 'androidx.cursoradapter:cursoradapter:1.0.0'
implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
implementation 'androidx.documentfile:documentfile:1.0.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.arch.core:core-runtime:2.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.fragment:fragment:1.0.0'
implementation 'androidx.core:core:1.1.0'
implementation 'com.google.android.gms:play-services-basement:17.0.0'
implementation 'com.google.android.gms:play-services-base:17.0.0'
}
Hope that helps. If there's a better way please tell. No flutter expert so far.

Microsoft.Data.Services.Client Nuget package trying to install wrong dependencies

In Visual Studio 2017 Update 3 (15.3), with latest Nuget (4.3.0.4339), I am trying to upgrade Microsoft.Data.Edm from 5.6.4 --> 5.8.2.
Attempting to gather dependency information for package 'Microsoft.Data.Edm.5.8.2' with respect to project 'ConsoleApps\FeedProvider', targeting '.NETFramework,Version=v4.6.1'
Gathering dependency information took 1.98 sec
Attempting to resolve dependencies for package 'Microsoft.Data.Edm.5.8.2' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.Data.Edm.5.8.2'
Resolved actions to install package 'Microsoft.Data.Edm.5.8.2'
Time Elapsed: 00:00:02.0136869
========== Finished ==========
On Nuget site Edm package does not list any dependencies. When confirmation window shows up it lists dependencies under installing section, which seem to be pulled from Microsoft.Data.Services.Client .NETStandard 1.1 list of dependencies:
I am clearly not using .NETStandard 1.1 for the project in question (nor any other project in this solution), as you can see if you scroll top log to the right with respect to project 'ConsoleApps\FeedProvider', targeting '.NETFramework,Version=v4.6.1'
Does anyone know what's up, or how to get around this problem?
Does anyone know what's up, or how to get around this problem?
Update answer according to the CrnaStena`s comment.
This package should be a problematic package. According to the Dependencies of the package Microsoft.Data.Services.Client:
We can notice that the dependencies Microsoft.Data.Edm has no framework specific. In this condition, NuGet will install the dependencies in the framework .NET Standard, Version=1.1. That why we got that confirmation window shows up the error dependencies.
In order to track this issue, I have create a new issue on GitHub:
NuGet install the wrong dependecies
To resolve this issue, I downloaded this package and add the dependence Microsoft.Data.Edm in to the .net framework 4.0 by NuGet Package Explorer.
Update:
Since there is a new version released:https://www.nuget.org/packages/Microsoft.Data.Services.Client/5.8.3
I have verified it, and it works fine.
Then save this package to the local feed, install the package from local feed.

Removing a dependency in a NuGet package

I'm getting this error when updating a package:
Attempting to resolve dependency XRM.Client.
Circular dependency detected.
Is there anyway to remove the dependency? I don't know how it got there in the first place.
I have tried uninstalling and removing all references to the old package.
The problem was due to having the package listed in the project's packages.config file as well as having a reference.
By leaving the reference in the project, and removing the package from the packages.config, it fixed the problem :)

Compiling greenDAO source

When I do a fresh git clone of the greenDAO repo, import the project with Android Studio, and try to compile, references to all the Android objects throw Unresolved Symbol/Method errors. Similarly, the Android specific import statements are also unresolved.
I've gotten as far as realizing that the build.gradle files don't call apply plugin: 'android', but instead lists dependencies like:
dependencies {
provided 'com.google.android:android:4.1.1.4'
provided 'com.google.android:android-test:4.1.1.4'
provided 'com.google.android:annotations:4.1.1.4'
provided 'com.google.android:support-v4:r7'
provided 'com.google.android:support-v4:r7'
...
}
I've used the SDK manager to make sure I have all the files for API v4.1 installed. I also know how to use greenDAO by using the Maven repos and/or importing JARs. My problem is specific to building from source.
Update 1: As stated, when using provided, none of the Android files are found.
I don't have enough reputation to post images, but you can find a screenshot here.