path_provider 1.6.16 causing “Invalid plugin specification” with older versions of Flutter

When trying to build Flutter application using the latest version of path_provider, the following error occurs

[ +4 ms] Found plugin path_provider at /home/ubuntu/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.16/
[ ] Found plugin path_provider_linux at /home/ubuntu/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/
[ +1 ms] Found plugin path_provider_macos at /home/ubuntu/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+4/
[ +1 ms] Found plugin path_provider_windows at /home/ubuntu/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.2/
[ +4 ms] “flutter get” took 12,611ms.
Invalid plugin specification.
Invalid “windows” plugin specification.

#0 throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1 new Plugin.fromYaml (package:flutter_tools/src/plugins.dart:77:7)
#2 _pluginFromPubspec (package:flutter_tools/src/plugins.dart:282:17)
#3 findPlugins. (package:flutter_tools/src/plugins.dart:305:27)
#4 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#5 findPlugins (package:flutter_tools/src/plugins.dart:303:12)
#6 refreshPluginsList (package:flutter_tools/src/plugins.dart:783:32)
#7 FlutterProject.ensureReadyForPlatformSpecificTooling (package:flutter_tools/src/project.dart:208:5)
#8 PackagesGetCommand.runCommand (package:flutter_tools/src/commands/packages.dart:130:23)

#9 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:615:18)

#10 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:515:33)

#11 AppContext.run. (package:flutter_tools/src/base/context.dart:146:29)
#12 _rootRun (dart:async/zone.dart:1126:13)
#13 _CustomZone.run (dart:async/zone.dart:1023:19)
#14 _runZoned (dart:async/zone.dart:1518:10)
#15 runZoned (dart:async/zone.dart:1465:12)
#16 AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#17 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:505:20)
#18 CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#19 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:413:21)

#20 AppContext.run. (package:flutter_tools/src/base/context.dart:146:29)
#21 _rootRun (dart:async/zone.dart:1126:13)
#22 _CustomZone.run (dart:async/zone.dart:1023:19)
#23 _runZoned (dart:async/zone.dart:1518:10)
#24 runZoned (dart:async/zone.dart:1465:12)
#25 AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#26 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:19)
#27 CommandRunner.run. (package:args/command_runner.dart:112:25)
#28 new Future.sync (dart:async/future.dart:224:31)
#29 CommandRunner.run (package:args/command_runner.dart:112:14)
#30 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:250:18)
#31 run.. (package:flutter_tools/runner.dart:63:22)
#32 _rootRun (dart:async/zone.dart:1126:13)
#33 _CustomZone.run (dart:async/zone.dart:1023:19)
#34 _runZoned (dart:async/zone.dart:1518:10)
#35 runZoned (dart:async/zone.dart:1502:12)
#36 run. (package:flutter_tools/runner.dart:61:18)

#37 AppContext.run. (package:flutter_tools/src/base/context.dart:146:29)
#38 _rootRun (dart:async/zone.dart:1126:13)
#39 _CustomZone.run (dart:async/zone.dart:1023:19)
#40 _runZoned (dart:async/zone.dart:1518:10)
#41 runZoned (dart:async/zone.dart:1465:12)
#42 AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#43 runInContext (package:flutter_tools/src/context_runner.dart:64:24)
#44 run (package:flutter_tools/runner.dart:50:10)
#45 main (package:flutter_tools/executable.dart:65:9)
#46 main (file:///home/ubuntu/flutter_infrastructure/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#47 _startIsolate. (dart:isolate-patch/isolate_patch.dart:305:32)
#48 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

It appears the new commit to support window (path_provider_windows) is the culprit.

1 possible answer(s) on “path_provider 1.6.16 causing “Invalid plugin specification” with older versions of Flutter

  1. Same issues, my flutter version is v1.17.2 and not going to upgrade to v1.20.+(which I tried actually work fun).
    finally, I solved by changing path_provider version to fixed 1.6.14

    path_provider: ^1.6.14 => path_provider: 1.6.14