You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地调试supabase_flutter时postgrest包修改无法生效怎么办?

解决调试supabase_flutter依赖的postgrest包跳转到.pub-cache的问题

1. 修正supabase_flutter对postgrest的依赖路径

打开supabase_flutter仓库内的packages/supabase_flutter/pubspec.yaml,找到postgrest的依赖配置,把原有的版本依赖(比如postgrest: ^x.x.x)替换为本地路径依赖:

postgrest:
  path: ../postgrest

这一步确保supabase_flutter使用你本地修改的postgrest包,而不是从pub.dev拉取的版本。

2. 重新执行Melos依赖链接

在supabase_flutter仓库根目录运行以下命令,清理旧依赖并重新链接所有本地子包:

melos clean
melos bootstrap

3. 验证自有项目的依赖来源

在你的自有项目根目录执行命令,查看依赖树:

dart pub deps

找到postgrest对应的条目,确认其来源是本地路径(比如../supabase_flutter/packages/postgrest)。如果仍显示pub.dev或.pub-cache路径,说明supabase_flutter的依赖配置没生效,回去检查第一步的修改是否正确。

4. 清除IDE缓存并重启

IDE可能会缓存旧的依赖文件路径,需要强制刷新:

  • VS Code:按Ctrl+Shift+P(Windows/Linux)或Cmd+Shift+P(Mac),选择「Developer: Reload Window」
  • Android Studio:点击「File → Invalidate Caches...」,选择「Invalidate and Restart」

5. 清理.lock文件(可选)

如果以上步骤都无效,删除以下文件后重新执行melos bootstrap和dart pub get:

  • 自有项目根目录的pubspec.lock
  • supabase_flutter仓库根目录及所有子包目录下的pubspec.lock

内容的提问来源于stack exchange,提问作者Michel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 03:33:37