@@ -31,9 +31,7 @@ final _screenSegmentMapper = _InsightMapper(
31
31
final path = insight.annotation.path ?? '' ;
32
32
final screenSegment = p.joinAll (
33
33
[
34
- path.isNotEmpty && path.startsWith (RegExp (r'[\\/]' ))
35
- ? path.substring (1 )
36
- : path,
34
+ path.isNotEmpty && path.startsWith (RegExp (r'[\\/]' )) ? path.substring (1 ) : path,
37
35
screenKey,
38
36
],
39
37
);
@@ -79,8 +77,7 @@ final insightMappers = [
79
77
_InsightMapper (
80
78
placeholder: Placeholders .IS_ACCESSIBLE_ONLY_IF_LOGGED_IN_AND_VERIFIED ,
81
79
mapInsights: (insight) async {
82
- final b =
83
- insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
80
+ final b = insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
84
81
return b.toString ();
85
82
},
86
83
),
@@ -101,8 +98,7 @@ final insightMappers = [
101
98
_InsightMapper (
102
99
placeholder: Placeholders .IS_ALWAYS_ACCESSIBLE ,
103
100
mapInsights: (insight) async {
104
- final a =
105
- insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
101
+ final a = insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
106
102
final b = insight.annotation.isAccessibleOnlyIfLoggedIn ?? false ;
107
103
final c = insight.annotation.isAccessibleOnlyIfLoggedOut ?? false ;
108
104
if (a && b) {
@@ -128,8 +124,9 @@ final insightMappers = [
128
124
placeholder: Placeholders .IS_REDIRECTABLE ,
129
125
mapInsights: (insight) async {
130
126
final b = insight.annotation.isRedirectable ?? false ;
131
- if (b) {
132
- for (final e in insight.annotation.internalParameters! ) {
127
+ final params = insight.annotation.internalParameters;
128
+ if (b && params != null && params.isNotEmpty) {
129
+ for (final e in params) {
133
130
final field = FieldUtils .ofOrNull (e)! ;
134
131
if (field.nullable == true ) {
135
132
throw Exception (
@@ -144,10 +141,8 @@ final insightMappers = [
144
141
_InsightMapper (
145
142
placeholder: Placeholders .IP0 ,
146
143
mapInsights: (insight) async {
147
- final params = insight.annotation.internalParameters
148
- ? .map ((e) => FieldUtils .ofOrNull (e))
149
- .nonNulls ??
150
- {};
144
+ final params =
145
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
151
146
if (params.isNotEmpty) {
152
147
final a = params.map ((e) {
153
148
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -175,10 +170,8 @@ final insightMappers = [
175
170
_InsightMapper (
176
171
placeholder: Placeholders .IP1 ,
177
172
mapInsights: (insight) async {
178
- final params = insight.annotation.internalParameters
179
- ? .map ((e) => FieldUtils .ofOrNull (e))
180
- .nonNulls ??
181
- {};
173
+ final params =
174
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
182
175
if (params.isNotEmpty) {
183
176
final a = params.map ((e) {
184
177
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -198,10 +191,8 @@ final insightMappers = [
198
191
_InsightMapper (
199
192
placeholder: Placeholders .IP2 ,
200
193
mapInsights: (insight) async {
201
- final params = insight.annotation.internalParameters
202
- ? .map ((e) => FieldUtils .ofOrNull (e))
203
- .nonNulls ??
204
- {};
194
+ final params =
195
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
205
196
if (params.isNotEmpty) {
206
197
final a = params.map ((e) {
207
198
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -219,10 +210,8 @@ final insightMappers = [
219
210
_InsightMapper (
220
211
placeholder: Placeholders .QP0 ,
221
212
mapInsights: (insight) async {
222
- final params = insight.annotation.queryParameters
223
- ? .map ((e) => FieldUtils .ofOrNull (e))
224
- .nonNulls ??
225
- {};
213
+ final params =
214
+ insight.annotation.queryParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
226
215
if (params.isNotEmpty) {
227
216
final a = params.map ((e) {
228
217
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -250,10 +239,8 @@ final insightMappers = [
250
239
_InsightMapper (
251
240
placeholder: Placeholders .QP1 ,
252
241
mapInsights: (insight) async {
253
- final params = insight.annotation.internalParameters
254
- ? .map ((e) => FieldUtils .ofOrNull (e))
255
- .nonNulls ??
256
- {};
242
+ final params =
243
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
257
244
if (params.isNotEmpty) {
258
245
final a = params.map ((e) {
259
246
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -270,10 +257,8 @@ final insightMappers = [
270
257
_InsightMapper (
271
258
placeholder: Placeholders .QP2 ,
272
259
mapInsights: (insight) async {
273
- final params = insight.annotation.internalParameters
274
- ? .map ((e) => FieldUtils .ofOrNull (e))
275
- .nonNulls ??
276
- {};
260
+ final params =
261
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
277
262
if (params.isNotEmpty) {
278
263
final a = params.map ((e) {
279
264
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -315,5 +300,4 @@ enum Placeholders {
315
300
TITLE ,
316
301
}
317
302
318
- typedef _InsightMapper
319
- = InsightMapper <ClassInsight <ModelGenerateScreenBindings >, Placeholders >;
303
+ typedef _InsightMapper = InsightMapper <ClassInsight <ModelGenerateScreenBindings >, Placeholders >;
0 commit comments