Thread
#multiplatform
    Kurt Renzo Acosta

    Kurt Renzo Acosta

    2 years ago
    Does anyone know how to solve this? I'm trying to use Firestore's IgnoreExtraProperties on KMP.
    // Common
    expect annotation class IgnoreExtraProperties()
    
    // Android
    actual typealias IgnoreExtraProperties = com.google.firebase.firestore.IgnoreExtraProperties
    However, when I try to run it, I get a
    This class does not have a constructor
    . I also did this but no luck. Maybe it's because the actual annotation is just an interface?
    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.TYPE})
    public @interface IgnoreExtraProperties {
    }
    Anyway, any help would be greatly appreciated!
    pajatopmr

    pajatopmr

    1 year ago
    My educated guess is that you want to start by implementing the interface and then, because the implementing class will be polymorphic when you add the @Serializable annotation, you will need to deal with "registering" the implementation in the scope of the interface. That means using a format + module or one of the ...PolymorphicSerializer strategies. My preferred solution is to use the JsonContentPolymorphicSerializer. Hope that helps.