Fix "tasks unexpectedly provided a task of type" error#2660
Fix "tasks unexpectedly provided a task of type" error#2660DanTup merged 1 commit intoDart-Code:masterfrom
Conversation
|
It's possible the better fix would be conditionally using pub/flutter here: Dart-Code/src/extension/extension.ts Line 337 in 41a7f4c Though I'm curious why I'm not seeing the same error you do. |
|
Ok, the issue was that I didn't have I think a better fix would be to use the correct ID based on the type of project (for example if you have a workspace with multiple projects, we should show the correct one for each). Something more like this: If I open a workspace with a Flutter + Dart project, this will then show the correct type: WDYT? |
|
eh, I wish that flutter did not create this pub/flutter division, it seems completely pointless. But your proposal looks good, I will update my MR later. |
|
Ok, I have updated. But, while doing this, I had another idea: maybe task provider should just have a different name that works both for pub and flutter, and then decide what to call when task is being ran. Instead of pub/flutter: build_runner watch use: Option A: build_runner: watch If this won't work for some reason, please merge as it is. |
|
I think it probably would - I'm not sure why I previously separated them in the UI. I don't think anyone running build_runner would be specifically looking for "flutter" so I think it could all just be using a Thanks! |
|
Let's just use pub then. PR updated. |
|
LGTM, thanks! |


Enable previewBuildRunnerTasks in flutter project and then execute
Command Palette > Tasks: Run task > Show all tasks...
You will see this error:
The task provider for "pub" tasks unexpectedly provided a task of type "flutter".
Probably because pub is hardcoded here:
Dart-Code/src/extension/extension.ts
Line 337 in b6aac60
So I changed the code to always use "pub".