Serialize the object to a map for use over the method channel.
Map<String, Object?> serializeAsMap() => { 'username': username, if (options != null) 'options': options!.serializeAsMap(), };