fix: revert null-aware map entries; disable use_null_aware_elements lint
The ? operator on map entries applies to the key, not the value. String literal keys can never be null, so ?'key': value was flagged as invalid_null_aware_operator. Reverted to if (x != null) 'key': x form and disabled the lint project-wide since it doesn't apply here.
This commit is contained in:
@@ -38,7 +38,7 @@ class NotesApi {
|
||||
'title': title,
|
||||
'body': body,
|
||||
'tags': tags,
|
||||
?'project_id': projectId,
|
||||
if (projectId != null) 'project_id': projectId,
|
||||
});
|
||||
return Note.fromJson(response.data as Map<String, dynamic>);
|
||||
} on DioException catch (e) {
|
||||
@@ -59,7 +59,7 @@ class NotesApi {
|
||||
'title': title,
|
||||
'body': body,
|
||||
'tags': tags,
|
||||
if (clearProject) 'project_id': null else ?'project_id': projectId,
|
||||
if (clearProject) 'project_id': null else if (projectId != null) 'project_id': projectId,
|
||||
});
|
||||
return Note.fromJson(response.data as Map<String, dynamic>);
|
||||
} on DioException catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user