Line data Source code
1 : // GENERATED CODE - DO NOT MODIFY BY HAND 2 : 3 : part of 'publishtype.dart'; 4 : 5 : // ************************************************************************** 6 : // SuperEnumGenerator 7 : // ************************************************************************** 8 : 9 : @immutable 10 : abstract class PublishType extends Equatable { 11 0 : const PublishType(this._type); 12 : 13 : factory PublishType.assetPublished() = AssetPublished; 14 : 15 : factory PublishType.entryPublished() = EntryPublished; 16 : 17 : factory PublishType.assetUnpublished() = AssetUnpublished; 18 : 19 : factory PublishType.assetDeleted() = AssetDeleted; 20 : 21 : factory PublishType.entryUnpublished() = EntryUnpublished; 22 : 23 : factory PublishType.entryDeleted() = EntryDeleted; 24 : 25 : factory PublishType.contentTypeDeleted() = ContentTypeDeleted; 26 : 27 : final _PublishType _type; 28 : 29 : //ignore: missing_return 30 1 : R when<R>( 31 : {@required R Function(AssetPublished) assetPublished, 32 : @required R Function(EntryPublished) entryPublished, 33 : @required R Function(AssetUnpublished) assetUnpublished, 34 : @required R Function(AssetDeleted) assetDeleted, 35 : @required R Function(EntryUnpublished) entryUnpublished, 36 : @required R Function(EntryDeleted) entryDeleted, 37 : @required R Function(ContentTypeDeleted) contentTypeDeleted}) { 38 1 : assert(() { 39 : if (assetPublished == null || 40 : entryPublished == null || 41 : assetUnpublished == null || 42 : assetDeleted == null || 43 : entryUnpublished == null || 44 : entryDeleted == null || 45 : contentTypeDeleted == null) { 46 : throw 'check for all possible cases'; 47 : } 48 : return true; 49 1 : }()); 50 1 : switch (this._type) { 51 1 : case _PublishType.AssetPublished: 52 1 : return assetPublished(this as AssetPublished); 53 1 : case _PublishType.EntryPublished: 54 1 : return entryPublished(this as EntryPublished); 55 1 : case _PublishType.AssetUnpublished: 56 1 : return assetUnpublished(this as AssetUnpublished); 57 1 : case _PublishType.AssetDeleted: 58 1 : return assetDeleted(this as AssetDeleted); 59 1 : case _PublishType.EntryUnpublished: 60 1 : return entryUnpublished(this as EntryUnpublished); 61 1 : case _PublishType.EntryDeleted: 62 1 : return entryDeleted(this as EntryDeleted); 63 1 : case _PublishType.ContentTypeDeleted: 64 1 : return contentTypeDeleted(this as ContentTypeDeleted); 65 : } 66 : } 67 : 68 : //ignore: missing_return 69 0 : Future<R> asyncWhen<R>( 70 : {@required FutureOr<R> Function(AssetPublished) assetPublished, 71 : @required FutureOr<R> Function(EntryPublished) entryPublished, 72 : @required FutureOr<R> Function(AssetUnpublished) assetUnpublished, 73 : @required FutureOr<R> Function(AssetDeleted) assetDeleted, 74 : @required FutureOr<R> Function(EntryUnpublished) entryUnpublished, 75 : @required FutureOr<R> Function(EntryDeleted) entryDeleted, 76 : @required FutureOr<R> Function(ContentTypeDeleted) contentTypeDeleted}) { 77 0 : assert(() { 78 : if (assetPublished == null || 79 : entryPublished == null || 80 : assetUnpublished == null || 81 : assetDeleted == null || 82 : entryUnpublished == null || 83 : entryDeleted == null || 84 : contentTypeDeleted == null) { 85 : throw 'check for all possible cases'; 86 : } 87 : return true; 88 0 : }()); 89 0 : switch (this._type) { 90 0 : case _PublishType.AssetPublished: 91 0 : return assetPublished(this as AssetPublished); 92 0 : case _PublishType.EntryPublished: 93 0 : return entryPublished(this as EntryPublished); 94 0 : case _PublishType.AssetUnpublished: 95 0 : return assetUnpublished(this as AssetUnpublished); 96 0 : case _PublishType.AssetDeleted: 97 0 : return assetDeleted(this as AssetDeleted); 98 0 : case _PublishType.EntryUnpublished: 99 0 : return entryUnpublished(this as EntryUnpublished); 100 0 : case _PublishType.EntryDeleted: 101 0 : return entryDeleted(this as EntryDeleted); 102 0 : case _PublishType.ContentTypeDeleted: 103 0 : return contentTypeDeleted(this as ContentTypeDeleted); 104 : } 105 : } 106 : 107 0 : R whenOrElse<R>( 108 : {R Function(AssetPublished) assetPublished, 109 : R Function(EntryPublished) entryPublished, 110 : R Function(AssetUnpublished) assetUnpublished, 111 : R Function(AssetDeleted) assetDeleted, 112 : R Function(EntryUnpublished) entryUnpublished, 113 : R Function(EntryDeleted) entryDeleted, 114 : R Function(ContentTypeDeleted) contentTypeDeleted, 115 : @required R Function(PublishType) orElse}) { 116 0 : assert(() { 117 : if (orElse == null) { 118 : throw 'Missing orElse case'; 119 : } 120 : return true; 121 0 : }()); 122 0 : switch (this._type) { 123 0 : case _PublishType.AssetPublished: 124 : if (assetPublished == null) break; 125 0 : return assetPublished(this as AssetPublished); 126 0 : case _PublishType.EntryPublished: 127 : if (entryPublished == null) break; 128 0 : return entryPublished(this as EntryPublished); 129 0 : case _PublishType.AssetUnpublished: 130 : if (assetUnpublished == null) break; 131 0 : return assetUnpublished(this as AssetUnpublished); 132 0 : case _PublishType.AssetDeleted: 133 : if (assetDeleted == null) break; 134 0 : return assetDeleted(this as AssetDeleted); 135 0 : case _PublishType.EntryUnpublished: 136 : if (entryUnpublished == null) break; 137 0 : return entryUnpublished(this as EntryUnpublished); 138 0 : case _PublishType.EntryDeleted: 139 : if (entryDeleted == null) break; 140 0 : return entryDeleted(this as EntryDeleted); 141 0 : case _PublishType.ContentTypeDeleted: 142 : if (contentTypeDeleted == null) break; 143 0 : return contentTypeDeleted(this as ContentTypeDeleted); 144 : } 145 0 : return orElse(this); 146 : } 147 : 148 0 : Future<R> asyncWhenOrElse<R>( 149 : {FutureOr<R> Function(AssetPublished) assetPublished, 150 : FutureOr<R> Function(EntryPublished) entryPublished, 151 : FutureOr<R> Function(AssetUnpublished) assetUnpublished, 152 : FutureOr<R> Function(AssetDeleted) assetDeleted, 153 : FutureOr<R> Function(EntryUnpublished) entryUnpublished, 154 : FutureOr<R> Function(EntryDeleted) entryDeleted, 155 : FutureOr<R> Function(ContentTypeDeleted) contentTypeDeleted, 156 : @required FutureOr<R> Function(PublishType) orElse}) { 157 0 : assert(() { 158 : if (orElse == null) { 159 : throw 'Missing orElse case'; 160 : } 161 : return true; 162 0 : }()); 163 0 : switch (this._type) { 164 0 : case _PublishType.AssetPublished: 165 : if (assetPublished == null) break; 166 0 : return assetPublished(this as AssetPublished); 167 0 : case _PublishType.EntryPublished: 168 : if (entryPublished == null) break; 169 0 : return entryPublished(this as EntryPublished); 170 0 : case _PublishType.AssetUnpublished: 171 : if (assetUnpublished == null) break; 172 0 : return assetUnpublished(this as AssetUnpublished); 173 0 : case _PublishType.AssetDeleted: 174 : if (assetDeleted == null) break; 175 0 : return assetDeleted(this as AssetDeleted); 176 0 : case _PublishType.EntryUnpublished: 177 : if (entryUnpublished == null) break; 178 0 : return entryUnpublished(this as EntryUnpublished); 179 0 : case _PublishType.EntryDeleted: 180 : if (entryDeleted == null) break; 181 0 : return entryDeleted(this as EntryDeleted); 182 0 : case _PublishType.ContentTypeDeleted: 183 : if (contentTypeDeleted == null) break; 184 0 : return contentTypeDeleted(this as ContentTypeDeleted); 185 : } 186 0 : return orElse(this); 187 : } 188 : 189 : //ignore: missing_return 190 0 : Future<void> whenPartial( 191 : {FutureOr<void> Function(AssetPublished) assetPublished, 192 : FutureOr<void> Function(EntryPublished) entryPublished, 193 : FutureOr<void> Function(AssetUnpublished) assetUnpublished, 194 : FutureOr<void> Function(AssetDeleted) assetDeleted, 195 : FutureOr<void> Function(EntryUnpublished) entryUnpublished, 196 : FutureOr<void> Function(EntryDeleted) entryDeleted, 197 : FutureOr<void> Function(ContentTypeDeleted) contentTypeDeleted}) { 198 0 : assert(() { 199 : if (assetPublished == null && 200 : entryPublished == null && 201 : assetUnpublished == null && 202 : assetDeleted == null && 203 : entryUnpublished == null && 204 : entryDeleted == null && 205 : contentTypeDeleted == null) { 206 : throw 'provide at least one branch'; 207 : } 208 : return true; 209 0 : }()); 210 0 : switch (this._type) { 211 0 : case _PublishType.AssetPublished: 212 : if (assetPublished == null) break; 213 0 : return assetPublished(this as AssetPublished); 214 0 : case _PublishType.EntryPublished: 215 : if (entryPublished == null) break; 216 0 : return entryPublished(this as EntryPublished); 217 0 : case _PublishType.AssetUnpublished: 218 : if (assetUnpublished == null) break; 219 0 : return assetUnpublished(this as AssetUnpublished); 220 0 : case _PublishType.AssetDeleted: 221 : if (assetDeleted == null) break; 222 0 : return assetDeleted(this as AssetDeleted); 223 0 : case _PublishType.EntryUnpublished: 224 : if (entryUnpublished == null) break; 225 0 : return entryUnpublished(this as EntryUnpublished); 226 0 : case _PublishType.EntryDeleted: 227 : if (entryDeleted == null) break; 228 0 : return entryDeleted(this as EntryDeleted); 229 0 : case _PublishType.ContentTypeDeleted: 230 : if (contentTypeDeleted == null) break; 231 0 : return contentTypeDeleted(this as ContentTypeDeleted); 232 : } 233 : } 234 : 235 0 : @override 236 : List get props => const []; 237 : } 238 : 239 : @immutable 240 : class AssetPublished extends PublishType { 241 0 : const AssetPublished._() : super(_PublishType.AssetPublished); 242 : 243 1 : factory AssetPublished() { 244 : _instance ??= const AssetPublished._(); 245 : return _instance; 246 : } 247 : 248 : static AssetPublished _instance; 249 : } 250 : 251 : @immutable 252 : class EntryPublished extends PublishType { 253 0 : const EntryPublished._() : super(_PublishType.EntryPublished); 254 : 255 1 : factory EntryPublished() { 256 : _instance ??= const EntryPublished._(); 257 : return _instance; 258 : } 259 : 260 : static EntryPublished _instance; 261 : } 262 : 263 : @immutable 264 : class AssetUnpublished extends PublishType { 265 0 : const AssetUnpublished._() : super(_PublishType.AssetUnpublished); 266 : 267 1 : factory AssetUnpublished() { 268 : _instance ??= const AssetUnpublished._(); 269 : return _instance; 270 : } 271 : 272 : static AssetUnpublished _instance; 273 : } 274 : 275 : @immutable 276 : class AssetDeleted extends PublishType { 277 0 : const AssetDeleted._() : super(_PublishType.AssetDeleted); 278 : 279 1 : factory AssetDeleted() { 280 : _instance ??= const AssetDeleted._(); 281 : return _instance; 282 : } 283 : 284 : static AssetDeleted _instance; 285 : } 286 : 287 : @immutable 288 : class EntryUnpublished extends PublishType { 289 0 : const EntryUnpublished._() : super(_PublishType.EntryUnpublished); 290 : 291 1 : factory EntryUnpublished() { 292 : _instance ??= const EntryUnpublished._(); 293 : return _instance; 294 : } 295 : 296 : static EntryUnpublished _instance; 297 : } 298 : 299 : @immutable 300 : class EntryDeleted extends PublishType { 301 0 : const EntryDeleted._() : super(_PublishType.EntryDeleted); 302 : 303 1 : factory EntryDeleted() { 304 : _instance ??= const EntryDeleted._(); 305 : return _instance; 306 : } 307 : 308 : static EntryDeleted _instance; 309 : } 310 : 311 : @immutable 312 : class ContentTypeDeleted extends PublishType { 313 0 : const ContentTypeDeleted._() : super(_PublishType.ContentTypeDeleted); 314 : 315 1 : factory ContentTypeDeleted() { 316 : _instance ??= const ContentTypeDeleted._(); 317 : return _instance; 318 : } 319 : 320 : static ContentTypeDeleted _instance; 321 : }