diff --git a/CHANGELOG.md b/CHANGELOG.md index 38c17f8..086681d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 3.6.25 + +- Changed `pois` and `poisIds` fields in `Locator` from non-nullable with default empty list to nullable `List?` and `List?`. + ## 3.6.24 - Added `graphqlIdFragment` and `graphqlUuidFragment` static constants to `Access` for GraphQL queries. diff --git a/lib/src/locator/locator.freezed.dart b/lib/src/locator/locator.freezed.dart index 3d526dd..12b4ecc 100644 --- a/lib/src/locator/locator.freezed.dart +++ b/lib/src/locator/locator.freezed.dart @@ -39,8 +39,8 @@ mixin _$Locator { String? get customizationId;/// [mapLayerId] is the id of the map layer to use for the locators that are using this layer. String? get mapLayerId;/// [mapLayer] is the map layer to use for the locators that are using this layer. MapLayer? get mapLayer;/// [pois] is the list of [Poi]s that are associated with the locator. - List get pois;/// [poisIds] is the list of [Poi]s that are associated with the locator. - List get poisIds; + List? get pois;/// [poisIds] is the list of [Poi]s that are associated with the locator. + List? get poisIds; /// Create a copy of Locator /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -73,7 +73,7 @@ abstract mixin class $LocatorCopyWith<$Res> { factory $LocatorCopyWith(Locator value, $Res Function(Locator) _then) = _$LocatorCopyWithImpl; @useResult $Res call({ - String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds,@TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired,@TimestampConverter() DateTime createdAt, User? createdBy, String? createdById,@TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List pois, List poisIds + String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds,@TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired,@TimestampConverter() DateTime createdAt, User? createdBy, String? createdById,@TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List? pois, List? poisIds }); @@ -90,7 +90,7 @@ class _$LocatorCopyWithImpl<$Res> /// Create a copy of Locator /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? token = null,Object? mqttConfig = freezed,Object? assets = freezed,Object? assetsIds = freezed,Object? geofences = freezed,Object? geofencesIds = freezed,Object? triggers = freezed,Object? triggersIds = freezed,Object? expiresAt = freezed,Object? expiredBy = freezed,Object? expiredById = freezed,Object? isExpired = freezed,Object? createdAt = null,Object? createdBy = freezed,Object? createdById = freezed,Object? updatedAt = null,Object? updatedBy = freezed,Object? updatedById = freezed,Object? customization = freezed,Object? customizationId = freezed,Object? mapLayerId = freezed,Object? mapLayer = freezed,Object? pois = null,Object? poisIds = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? token = null,Object? mqttConfig = freezed,Object? assets = freezed,Object? assetsIds = freezed,Object? geofences = freezed,Object? geofencesIds = freezed,Object? triggers = freezed,Object? triggersIds = freezed,Object? expiresAt = freezed,Object? expiredBy = freezed,Object? expiredById = freezed,Object? isExpired = freezed,Object? createdAt = null,Object? createdBy = freezed,Object? createdById = freezed,Object? updatedAt = null,Object? updatedBy = freezed,Object? updatedById = freezed,Object? customization = freezed,Object? customizationId = freezed,Object? mapLayerId = freezed,Object? mapLayer = freezed,Object? pois = freezed,Object? poisIds = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable @@ -115,9 +115,9 @@ as String?,customization: freezed == customization ? _self.customization : custo as RegisteredApp?,customizationId: freezed == customizationId ? _self.customizationId : customizationId // ignore: cast_nullable_to_non_nullable as String?,mapLayerId: freezed == mapLayerId ? _self.mapLayerId : mapLayerId // ignore: cast_nullable_to_non_nullable as String?,mapLayer: freezed == mapLayer ? _self.mapLayer : mapLayer // ignore: cast_nullable_to_non_nullable -as MapLayer?,pois: null == pois ? _self.pois : pois // ignore: cast_nullable_to_non_nullable -as List,poisIds: null == poisIds ? _self.poisIds : poisIds // ignore: cast_nullable_to_non_nullable -as List, +as MapLayer?,pois: freezed == pois ? _self.pois : pois // ignore: cast_nullable_to_non_nullable +as List?,poisIds: freezed == poisIds ? _self.poisIds : poisIds // ignore: cast_nullable_to_non_nullable +as List?, )); } /// Create a copy of Locator @@ -274,7 +274,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds, @TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired, @TimestampConverter() DateTime createdAt, User? createdBy, String? createdById, @TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List pois, List poisIds)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds, @TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired, @TimestampConverter() DateTime createdAt, User? createdBy, String? createdById, @TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List? pois, List? poisIds)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _Locator() when $default != null: return $default(_that.id,_that.token,_that.mqttConfig,_that.assets,_that.assetsIds,_that.geofences,_that.geofencesIds,_that.triggers,_that.triggersIds,_that.expiresAt,_that.expiredBy,_that.expiredById,_that.isExpired,_that.createdAt,_that.createdBy,_that.createdById,_that.updatedAt,_that.updatedBy,_that.updatedById,_that.customization,_that.customizationId,_that.mapLayerId,_that.mapLayer,_that.pois,_that.poisIds);case _: @@ -295,7 +295,7 @@ return $default(_that.id,_that.token,_that.mqttConfig,_that.assets,_that.assetsI /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds, @TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired, @TimestampConverter() DateTime createdAt, User? createdBy, String? createdById, @TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List pois, List poisIds) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds, @TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired, @TimestampConverter() DateTime createdAt, User? createdBy, String? createdById, @TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List? pois, List? poisIds) $default,) {final _that = this; switch (_that) { case _Locator(): return $default(_that.id,_that.token,_that.mqttConfig,_that.assets,_that.assetsIds,_that.geofences,_that.geofencesIds,_that.triggers,_that.triggersIds,_that.expiresAt,_that.expiredBy,_that.expiredById,_that.isExpired,_that.createdAt,_that.createdBy,_that.createdById,_that.updatedAt,_that.updatedBy,_that.updatedById,_that.customization,_that.customizationId,_that.mapLayerId,_that.mapLayer,_that.pois,_that.poisIds);case _: @@ -315,7 +315,7 @@ return $default(_that.id,_that.token,_that.mqttConfig,_that.assets,_that.assetsI /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds, @TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired, @TimestampConverter() DateTime createdAt, User? createdBy, String? createdById, @TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List pois, List poisIds)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds, @TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired, @TimestampConverter() DateTime createdAt, User? createdBy, String? createdById, @TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List? pois, List? poisIds)? $default,) {final _that = this; switch (_that) { case _Locator() when $default != null: return $default(_that.id,_that.token,_that.mqttConfig,_that.assets,_that.assetsIds,_that.geofences,_that.geofencesIds,_that.triggers,_that.triggersIds,_that.expiresAt,_that.expiredBy,_that.expiredById,_that.isExpired,_that.createdAt,_that.createdBy,_that.createdById,_that.updatedAt,_that.updatedBy,_that.updatedById,_that.customization,_that.customizationId,_that.mapLayerId,_that.mapLayer,_that.pois,_that.poisIds);case _: @@ -330,7 +330,7 @@ return $default(_that.id,_that.token,_that.mqttConfig,_that.assets,_that.assetsI @JsonSerializable() class _Locator extends Locator { - const _Locator({required this.id, required this.token, this.mqttConfig, final List? assets, final List? assetsIds, final List? geofences, final List? geofencesIds, final List? triggers, final List? triggersIds, @TimestampOrNullConverter() this.expiresAt, this.expiredBy, this.expiredById, this.isExpired, @TimestampConverter() required this.createdAt, this.createdBy, this.createdById, @TimestampConverter() required this.updatedAt, this.updatedBy, this.updatedById, this.customization, this.customizationId, this.mapLayerId, this.mapLayer, final List pois = const [], final List poisIds = const []}): _assets = assets,_assetsIds = assetsIds,_geofences = geofences,_geofencesIds = geofencesIds,_triggers = triggers,_triggersIds = triggersIds,_pois = pois,_poisIds = poisIds,super._(); + const _Locator({required this.id, required this.token, this.mqttConfig, final List? assets, final List? assetsIds, final List? geofences, final List? geofencesIds, final List? triggers, final List? triggersIds, @TimestampOrNullConverter() this.expiresAt, this.expiredBy, this.expiredById, this.isExpired, @TimestampConverter() required this.createdAt, this.createdBy, this.createdById, @TimestampConverter() required this.updatedAt, this.updatedBy, this.updatedById, this.customization, this.customizationId, this.mapLayerId, this.mapLayer, final List? pois, final List? poisIds}): _assets = assets,_assetsIds = assetsIds,_geofences = geofences,_geofencesIds = geofencesIds,_triggers = triggers,_triggersIds = triggersIds,_pois = pois,_poisIds = poisIds,super._(); factory _Locator.fromJson(Map json) => _$LocatorFromJson(json); /// [id] is the UUIDv4 identifier of the locator @@ -434,21 +434,25 @@ class _Locator extends Locator { /// [mapLayer] is the map layer to use for the locators that are using this layer. @override final MapLayer? mapLayer; /// [pois] is the list of [Poi]s that are associated with the locator. - final List _pois; + final List? _pois; /// [pois] is the list of [Poi]s that are associated with the locator. -@override@JsonKey() List get pois { +@override List? get pois { + final value = _pois; + if (value == null) return null; if (_pois is EqualUnmodifiableListView) return _pois; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_pois); + return EqualUnmodifiableListView(value); } /// [poisIds] is the list of [Poi]s that are associated with the locator. - final List _poisIds; + final List? _poisIds; /// [poisIds] is the list of [Poi]s that are associated with the locator. -@override@JsonKey() List get poisIds { +@override List? get poisIds { + final value = _poisIds; + if (value == null) return null; if (_poisIds is EqualUnmodifiableListView) return _poisIds; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_poisIds); + return EqualUnmodifiableListView(value); } @@ -485,7 +489,7 @@ abstract mixin class _$LocatorCopyWith<$Res> implements $LocatorCopyWith<$Res> { factory _$LocatorCopyWith(_Locator value, $Res Function(_Locator) _then) = __$LocatorCopyWithImpl; @override @useResult $Res call({ - String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds,@TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired,@TimestampConverter() DateTime createdAt, User? createdBy, String? createdById,@TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List pois, List poisIds + String id, String token, LocatorMqttConfig? mqttConfig, List? assets, List? assetsIds, List? geofences, List? geofencesIds, List? triggers, List? triggersIds,@TimestampOrNullConverter() DateTime? expiresAt, User? expiredBy, String? expiredById, bool? isExpired,@TimestampConverter() DateTime createdAt, User? createdBy, String? createdById,@TimestampConverter() DateTime updatedAt, User? updatedBy, String? updatedById, RegisteredApp? customization, String? customizationId, String? mapLayerId, MapLayer? mapLayer, List? pois, List? poisIds }); @@ -502,7 +506,7 @@ class __$LocatorCopyWithImpl<$Res> /// Create a copy of Locator /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? token = null,Object? mqttConfig = freezed,Object? assets = freezed,Object? assetsIds = freezed,Object? geofences = freezed,Object? geofencesIds = freezed,Object? triggers = freezed,Object? triggersIds = freezed,Object? expiresAt = freezed,Object? expiredBy = freezed,Object? expiredById = freezed,Object? isExpired = freezed,Object? createdAt = null,Object? createdBy = freezed,Object? createdById = freezed,Object? updatedAt = null,Object? updatedBy = freezed,Object? updatedById = freezed,Object? customization = freezed,Object? customizationId = freezed,Object? mapLayerId = freezed,Object? mapLayer = freezed,Object? pois = null,Object? poisIds = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? token = null,Object? mqttConfig = freezed,Object? assets = freezed,Object? assetsIds = freezed,Object? geofences = freezed,Object? geofencesIds = freezed,Object? triggers = freezed,Object? triggersIds = freezed,Object? expiresAt = freezed,Object? expiredBy = freezed,Object? expiredById = freezed,Object? isExpired = freezed,Object? createdAt = null,Object? createdBy = freezed,Object? createdById = freezed,Object? updatedAt = null,Object? updatedBy = freezed,Object? updatedById = freezed,Object? customization = freezed,Object? customizationId = freezed,Object? mapLayerId = freezed,Object? mapLayer = freezed,Object? pois = freezed,Object? poisIds = freezed,}) { return _then(_Locator( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable @@ -527,9 +531,9 @@ as String?,customization: freezed == customization ? _self.customization : custo as RegisteredApp?,customizationId: freezed == customizationId ? _self.customizationId : customizationId // ignore: cast_nullable_to_non_nullable as String?,mapLayerId: freezed == mapLayerId ? _self.mapLayerId : mapLayerId // ignore: cast_nullable_to_non_nullable as String?,mapLayer: freezed == mapLayer ? _self.mapLayer : mapLayer // ignore: cast_nullable_to_non_nullable -as MapLayer?,pois: null == pois ? _self._pois : pois // ignore: cast_nullable_to_non_nullable -as List,poisIds: null == poisIds ? _self._poisIds : poisIds // ignore: cast_nullable_to_non_nullable -as List, +as MapLayer?,pois: freezed == pois ? _self._pois : pois // ignore: cast_nullable_to_non_nullable +as List?,poisIds: freezed == poisIds ? _self._poisIds : poisIds // ignore: cast_nullable_to_non_nullable +as List?, )); } diff --git a/lib/src/locator/locator.g.dart b/lib/src/locator/locator.g.dart index cda3a31..a5f5a15 100644 --- a/lib/src/locator/locator.g.dart +++ b/lib/src/locator/locator.g.dart @@ -56,14 +56,12 @@ _Locator _$LocatorFromJson(Map json) => _Locator( mapLayer: json['mapLayer'] == null ? null : MapLayer.fromJson(json['mapLayer'] as Map), - pois: - (json['pois'] as List?) - ?.map((e) => Poi.fromJson(e as Map)) - .toList() ?? - const [], - poisIds: - (json['poisIds'] as List?)?.map((e) => e as String).toList() ?? - const [], + pois: (json['pois'] as List?) + ?.map((e) => Poi.fromJson(e as Map)) + .toList(), + poisIds: (json['poisIds'] as List?) + ?.map((e) => e as String) + .toList(), ); Map _$LocatorToJson(_Locator instance) => { @@ -90,7 +88,7 @@ Map _$LocatorToJson(_Locator instance) => { 'customizationId': instance.customizationId, 'mapLayerId': instance.mapLayerId, 'mapLayer': instance.mapLayer?.toJson(), - 'pois': instance.pois.map((e) => e.toJson()).toList(), + 'pois': instance.pois?.map((e) => e.toJson()).toList(), 'poisIds': instance.poisIds, }; diff --git a/lib/src/locator/src/locator.dart b/lib/src/locator/src/locator.dart index f1f94c4..3733d21 100644 --- a/lib/src/locator/src/locator.dart +++ b/lib/src/locator/src/locator.dart @@ -75,10 +75,10 @@ abstract class Locator with _$Locator { MapLayer? mapLayer, /// [pois] is the list of [Poi]s that are associated with the locator. - @Default([]) List pois, + List? pois, /// [poisIds] is the list of [Poi]s that are associated with the locator. - @Default([]) List poisIds, + List? poisIds, }) = _Locator; factory Locator.fromJson(Map json) => _$LocatorFromJson(json); diff --git a/pubspec.yaml b/pubspec.yaml index b84dbd4..f788617 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ description: Layrz API models for Dart/Flutter. This package contains the models used by the Layrz API. name: layrz_models -version: "3.6.24" +version: "3.6.25" repository: https://github.com/goldenm-software/layrz_models environment: