Line data Source code
1 : // GENERATED CODE - DO NOT MODIFY BY HAND 2 : 3 : part of 'include.dart'; 4 : 5 : // ************************************************************************** 6 : // SuperEnumGenerator 7 : // ************************************************************************** 8 : 9 : @immutable 10 : abstract class Include extends Equatable { 11 2 : const Include(this._type); 12 : 13 : factory Include.none({@required List<String> fieldUidList}) = None; 14 : 15 : factory Include.only({@required List<String> fieldUidList}) = Only; 16 : 17 : factory Include.except({@required List<String> fieldUidList}) = Except; 18 : 19 : final _Include _type; 20 : 21 : //ignore: missing_return 22 2 : R when<R>( 23 : {@required R Function(None) none, 24 : @required R Function(Only) only, 25 : @required R Function(Except) except}) { 26 2 : assert(() { 27 : if (none == null || only == null || except == null) { 28 : throw 'check for all possible cases'; 29 : } 30 : return true; 31 2 : }()); 32 2 : switch (this._type) { 33 2 : case _Include.None: 34 2 : return none(this as None); 35 2 : case _Include.Only: 36 2 : return only(this as Only); 37 2 : case _Include.Except: 38 2 : return except(this as Except); 39 : } 40 : } 41 : 42 : //ignore: missing_return 43 0 : Future<R> asyncWhen<R>( 44 : {@required FutureOr<R> Function(None) none, 45 : @required FutureOr<R> Function(Only) only, 46 : @required FutureOr<R> Function(Except) except}) { 47 0 : assert(() { 48 : if (none == null || only == null || except == null) { 49 : throw 'check for all possible cases'; 50 : } 51 : return true; 52 0 : }()); 53 0 : switch (this._type) { 54 0 : case _Include.None: 55 0 : return none(this as None); 56 0 : case _Include.Only: 57 0 : return only(this as Only); 58 0 : case _Include.Except: 59 0 : return except(this as Except); 60 : } 61 : } 62 : 63 0 : R whenOrElse<R>( 64 : {R Function(None) none, 65 : R Function(Only) only, 66 : R Function(Except) except, 67 : @required R Function(Include) orElse}) { 68 0 : assert(() { 69 : if (orElse == null) { 70 : throw 'Missing orElse case'; 71 : } 72 : return true; 73 0 : }()); 74 0 : switch (this._type) { 75 0 : case _Include.None: 76 : if (none == null) break; 77 0 : return none(this as None); 78 0 : case _Include.Only: 79 : if (only == null) break; 80 0 : return only(this as Only); 81 0 : case _Include.Except: 82 : if (except == null) break; 83 0 : return except(this as Except); 84 : } 85 0 : return orElse(this); 86 : } 87 : 88 0 : Future<R> asyncWhenOrElse<R>( 89 : {FutureOr<R> Function(None) none, 90 : FutureOr<R> Function(Only) only, 91 : FutureOr<R> Function(Except) except, 92 : @required FutureOr<R> Function(Include) orElse}) { 93 0 : assert(() { 94 : if (orElse == null) { 95 : throw 'Missing orElse case'; 96 : } 97 : return true; 98 0 : }()); 99 0 : switch (this._type) { 100 0 : case _Include.None: 101 : if (none == null) break; 102 0 : return none(this as None); 103 0 : case _Include.Only: 104 : if (only == null) break; 105 0 : return only(this as Only); 106 0 : case _Include.Except: 107 : if (except == null) break; 108 0 : return except(this as Except); 109 : } 110 0 : return orElse(this); 111 : } 112 : 113 : //ignore: missing_return 114 0 : Future<void> whenPartial( 115 : {FutureOr<void> Function(None) none, 116 : FutureOr<void> Function(Only) only, 117 : FutureOr<void> Function(Except) except}) { 118 0 : assert(() { 119 : if (none == null && only == null && except == null) { 120 : throw 'provide at least one branch'; 121 : } 122 : return true; 123 0 : }()); 124 0 : switch (this._type) { 125 0 : case _Include.None: 126 : if (none == null) break; 127 0 : return none(this as None); 128 0 : case _Include.Only: 129 : if (only == null) break; 130 0 : return only(this as Only); 131 0 : case _Include.Except: 132 : if (except == null) break; 133 0 : return except(this as Except); 134 : } 135 : } 136 : 137 0 : @override 138 : List get props => const []; 139 : } 140 : 141 : @immutable 142 : class None extends Include { 143 4 : const None({@required this.fieldUidList}) : super(_Include.None); 144 : 145 : final List<String> fieldUidList; 146 : 147 0 : @override 148 0 : String toString() => 'None(fieldUidList:${this.fieldUidList})'; 149 0 : @override 150 0 : List get props => [fieldUidList]; 151 : } 152 : 153 : @immutable 154 : class Only extends Include { 155 4 : const Only({@required this.fieldUidList}) : super(_Include.Only); 156 : 157 : final List<String> fieldUidList; 158 : 159 0 : @override 160 0 : String toString() => 'Only(fieldUidList:${this.fieldUidList})'; 161 0 : @override 162 0 : List get props => [fieldUidList]; 163 : } 164 : 165 : @immutable 166 : class Except extends Include { 167 4 : const Except({@required this.fieldUidList}) : super(_Include.Except); 168 : 169 : final List<String> fieldUidList; 170 : 171 0 : @override 172 0 : String toString() => 'Except(fieldUidList:${this.fieldUidList})'; 173 0 : @override 174 0 : List get props => [fieldUidList]; 175 : }