We were sending JSON Encoded data from Flutter Dart to Swift code. This was then changed to a dictionary of type [String: Any]
Since metadata is also a dictionary of it's own, we were casting Any to NSMutableDictionary. Since the parent dictionary is not a NSMutableDictionary, the metadata cast was failing. Because of this, a null value was getting set to metadata object.
Fix:
We are not casting metadata to NSMutableDictionary, rather we are casting it to [String: Any] dictionary, which is the same as it's parent dictionary.
Root cause:
Fix: