Import Types from the _flutter app #4628
-
|
I'm looking for a way to use data types defined in my _flutter app in _server I have been working on a flutter app for some time. I have added the front end app into pubspec.yaml myapp_sp_flutter(": path: ../myapp_sp_flutter") But when I run "dart bin/main.dart --apply-migrations" I get hundreds of errors for items in flutter and pub cache (image attached). Is there a way I can achieve this, please? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @ian-pop! π Importing the app in the server is a bad ideia, since it will carry the Flutter SDK and all dependencies, platform code, etc. If you don't want to rebuild your models as Serverpod models (which would be the safest approach), the best alternative is to move them out of the app to a shared package that does not depend on Flutter. You can then import this package in both the app and the server safely. Take a look at the docs for how to use custom types. |
Beta Was this translation helpful? Give feedback.
Hi @ian-pop! π
Importing the app in the server is a bad ideia, since it will carry the Flutter SDK and all dependencies, platform code, etc. If you don't want to rebuild your models as Serverpod models (which would be the safest approach), the best alternative is to move them out of the app to a shared package that does not depend on Flutter. You can then import this package in both the app and the server safely. Take a look at the docs for how to use custom types.