skip to Main Content

I’m trying to debug the supabase_flutter repository locally. Their is some functionality within the packages, that I can test best within an app I’m working on. Therefore I’m trying to use the local repo as a dependency within the pubspec.yaml of my app.

I already forked and cloned the repo to my local machine, initialized everything with melos and added the local package as an dependency according to the README.

When I’m trying to inspect an imported function in my app from the package ‘supabase_flutter’, the related local file of the repo opens as expected. But when I’m trying to inspect a function from the ‘postgrest’ package, I only get send to a copy of the file in the .pub-cache directory.

This means, that I am unable to test any changes I make to files of the ‘postgrest’ package in my app, because the copied file in the .pub-cache directory doesn’t get updated. I can only debug changes that I make to the ‘supabase_flutter’ package, like adding a print statement to the Supabase.initialize function. My initial goal was to debug the PostgrestTransformBuilder<T> range(int from, int to, {String? referencedTable}) function at packages/postgrest/lib/src/postgrest_transform_builder.dart and add a print statement there.

I already tried different combinations of pub get, pub upgrade and melos bootstrap together with deleting the .pub-cache directory multiple times.

2

Answers


  1. Chosen as BEST ANSWER

    I found the solution / a workaround for my needs. According to the README of the supabase_flutter repo, it is sufficient to add the local path of the supabase_flutter package to the project you want to import it, like:

      supabase_flutter:
        path: <your-path-to-the-local-supabase-flutter-repo>/packages/supabase_flutter
    

    But the other packages in the monorepo still get imported from pub.dev instead of their local versions. The solution for me was to change all the dependencies to other packages from the monorepo in all pubspec.yaml of the packages. For example, in the pubspec.yaml of the local supabase_flutter package:

      supabase:
        path: <your-path-to-the-local-supabase-flutter-repo>/packages/supabase
    

    Only then and after running melos bs in the repo again, the correct local versions of all packages are imported correctly, which then allows for debugging of their functions.

    I'm not sure if I misunderstood the functionalities of melos or rather the dart packaging system itself, and maybe this is intended behavior. Unfortunately, I didn't find any clue for this procedure in the README of the supabase_flutter repo.


  2. This is not a Supabase-specific question, but rather a question of how the Dart packaging system works.

    I would try the following:

    • Delete the pubspec.lock file in your Flutter app
    • Run melos bs in the supabase_flutter package
    • Run pub get in your Flutter app
    • Verify in your pubspec.lock file in your Flutter app that it is using the local version of the dependencies.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search