5

I am making use of the package "sms_maintained" which is only available for Android.

However, the project needs an iOS version and what I am doing currently is to remove the package when developing for iOS.

How can I keep the package in the pubspec.yaml file but disable iOS from checking into the package? The goal is to have a uniform codebase.

I have tried to exclude the package in the Podfile using

skip_line_start_symbols = ["#", "/","sms_maintained"]

which skips the package but during build a reference is made to GeneratedPluginRegistrant which is auto generated.

Any help will be appreciated, thanks.

Benedictgeek
  • 167
  • 1
  • 2
  • 9
  • I'm just wondering what's the problem if the package is not excluded ? You should check the iOS implementation, I'm pretty sure it will return a default response. – danypata Jun 29 '20 at 11:52
  • How do you expect Flutter to not to register the plugin? You are literally using it on Android. – Firat Jun 29 '20 at 12:07
  • yeah @danypata just like @Firat is insinuating, it throws this during build "No podspec found for `sms_maintained`" – Benedictgeek Jun 29 '20 at 12:13

2 Answers2

1

https://flutter.dev/docs/deployment/flavors

check this out, you can setup different flavours according to different environment of release and development

Yadu
  • 2,979
  • 2
  • 12
  • 27
  • 1
    Thanks for the pointer, flavors are really cool but if I change the packages to suit the platform during build, it will still cause build issues as references to the package in the project will point to no file. What I would like is to keep the package there but tell flutter to not register it – Benedictgeek Jun 30 '20 at 09:16
1

So I found a solution to the problem, the sms_maintained package indeed has a podspec file named sms.podspec in the ios/.symlinks/plugins which should be renamed to sms_maintained.podspec.

Also open the file and rename sms in the s.name key to sms_maintained

Rerun the app

Benedictgeek
  • 167
  • 1
  • 2
  • 9
  • 1
    It would be nice if you could explain this a little bit more. As I as reader cannot know what do you mean by "sms", "open the file" etc – Nihad Delic Oct 14 '21 at 14:48