f2prateek/dart

Parceler support is too strong

Closed this issue · 5 comments

After merging : https://github.com/f2prateek/dart/pull/76/files
@johncarl81 @iainconnor

we see a problem : devs need Parceler to serialize something like an ArrayList. It would even try to use Parceler if it is not available, making the intentfactory and extrainjector fail.
Good catch @dlemures !

So, we would like to make things a bit more subtile :

  • for collections whose elements use Parceler, use Parceler
  • for collections that are serializable whose elements don't use Parceler, use serializable
  • for collections that are not serializable whose elements don't use Parceler, they are not accepted
  • for types that use Parceler, use it (e.g. @Parceler class House)

Parceler serialization should be a fallback. If you can serialize using a native technique then you should opt for that.

Yeah, that's exactly our problem right now. We are patching in #93

This may be relavent if you're looking for a different approach to support Parceler: #36

I think our current problem are not really solvable via adapters. But tomorrow we should get something stable on #93

Fixed #93
Final strategy:

  1. If Parcelable is available, and the collection can be handled by it (elements are Serializable, Parcelable or use @parcel), use Parceler.
  2. If Parcelable is not available, but the collection is serializable, we accept them.
  3. If Parcelable is not available, but the collection is not serializable, we don't accept them (we cannot).