[shared_preferences] Fix Android type mismatch regression (#8512)
getStringList should throw a TypeError if the stored value is of a
different type, but the recent change to use JSON-encoded string lists
regression that behavior if the stored type was a string, causing it to
instead return null.
This restores the previous behavior by passing extra information from
Kotlin to Dart when attempting to get an enecoded string list, so that
if a non-encoded-list string is found, a TypeError can be created on the
Dart side.
Since extra information is now being passed, the case of a
legacy-encoded value is now communicated as well, so that we only have
to request the legacy value if it's there, rather than always trying
(which was not worth the complexity of adding extra data just for that
initially, but now that we need extra data anyway, it's easy to
distinguish that case).
Fixes OOB regression in shared_preferences tests that has closed the
tree.