Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make sure the package can be built on Flutter web #990

Merged
merged 6 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/supabase_flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ jobs:
run: |
flutter pub downgrade app_links
flutter test --concurrency=1

- name: Verify if Flutter web build is successful
run: |
cd example
flutter build web
18 changes: 18 additions & 0 deletions packages/supabase_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@ dev_dependencies:

flutter:
uses-material-design: true
melos_managed_dependency_overrides: functions_client,gotrue,postgrest,realtime_client,storage_client,yet_another_json_isolate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about these changes here. Did you run any command to produce these lines? Is there no way to include the example in the bootstrap to avoid modifying the overrides in the pubspec.yaml?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the concern? For now, this solves our issue, ensuring that the package works on Flutter web. I can see that this can cause slight inconvenience for anyone viewing the example directly, but that's not the top priority issue that we have right now, and we can take our time to figure out if there is a better way of overriding the dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I have updated the melos config instead of the pubspec.yaml file of the example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And of course now the tests are failing 😂

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't add the packages to the bootstrap section. Just the oneline under packages

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI is probably failing, because pub get for the example app is running before some of the other packages. I have to run now for a bit, but will take a look when I come back.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was, that melso tried to use the flutter cli, because the example is a flutter package and was not excluded like the supabase_flutter package everywhere manually.

dependency_overrides:
functions_client:
path: ../../functions_client
gotrue:
path: ../../gotrue
postgrest:
path: ../../postgrest
realtime_client:
path: ../../realtime_client
storage_client:
path: ../../storage_client
supabase:
path: ../../supabase
yet_another_json_isolate:
path: ../../yet_another_json_isolate
supabase_flutter:
path: ../
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class YAJsonIsolate {
return jsonDecode(json);
}

Future<String> encode(Map json) async {
Future<String> encode(Object? json) async {
await null;
return jsonEncode(json);
}
Expand Down
Loading