Browse Source

dynamite, neon, nextcloud: nullaware spreads (codestyle)

pull/289/head
Nikolas Rimikis 2 years ago
parent
commit
8394d9c4ef
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 15
      packages/dynamite/lib/src/openapi_builder.dart
  2. 8
      packages/neon/neon/lib/src/widgets/list_view.dart
  3. 8
      packages/neon/neon_notes/lib/widgets/notes_view.dart
  4. 4
      packages/nextcloud/lib/src/nextcloud.openapi.dart

15
packages/dynamite/lib/src/openapi_builder.dart

@ -33,9 +33,7 @@ class OpenAPIBuilder implements Builder {
if (spec.paths != null) ...{
for (final pathItem in spec.paths!.values) ...{
for (final operation in pathItem.operations.values) ...{
if (operation.tags != null) ...{
...operation.tags!,
},
...?operation.tags,
},
},
},
@ -518,9 +516,7 @@ class OpenAPIBuilder implements Builder {
])
..body = const Code('''
this.baseHeaders = {
if (baseHeaders != null) ...{
...baseHeaders,
},
...?baseHeaders,
};
this.httpClient = (httpClient ?? HttpClient())..userAgent = userAgent;
'''),
@ -670,12 +666,7 @@ class OpenAPIBuilder implements Builder {
final acceptHeader = operation.responses?.values
.map((final response) => response.content?.keys)
.reduce(
(final a, final b) => [
...a ?? [],
...b ?? [],
],
)
.reduce((final a, final b) => [...?a, ...?b])
?.toSet()
.join(',');
final code = StringBuffer('''

8
packages/neon/neon/lib/src/widgets/list_view.dart

@ -29,9 +29,7 @@ class NeonListView<T> extends StatelessWidget {
onRefresh: onRefresh,
child: Column(
children: [
if (topFixedChildren != null) ...[
...topFixedChildren!,
],
...?topFixedChildren,
NeonLinearProgressIndicator(
margin: const EdgeInsets.symmetric(
horizontal: 10,
@ -47,9 +45,7 @@ class NeonListView<T> extends StatelessWidget {
key: scrollKey != null ? PageStorageKey<String>(scrollKey!) : null,
padding: withFloatingActionButton ? const EdgeInsets.only(bottom: 88) : null,
children: [
if (topScrollingChildren != null) ...[
...topScrollingChildren!,
],
...?topScrollingChildren,
NeonException(
error,
onRetry: onRefresh,

8
packages/neon/neon_notes/lib/widgets/notes_view.dart

@ -51,12 +51,8 @@ class NotesView extends StatelessWidget {
scrollKey: 'notes-notes',
withFloatingActionButton: true,
items: [
if (sortedFavorites != null) ...[
...sortedFavorites,
],
if (sortedNonFavorites != null) ...[
...sortedNonFavorites,
],
...?sortedFavorites,
...?sortedNonFavorites,
],
isLoading: notes.loading,
error: notes.error,

4
packages/nextcloud/lib/src/nextcloud.openapi.dart

@ -106,9 +106,7 @@ class NextcloudClient {
this.authentications = const [],
}) {
this.baseHeaders = {
if (baseHeaders != null) ...{
...baseHeaders,
},
...?baseHeaders,
};
this.httpClient = (httpClient ?? HttpClient())..userAgent = userAgent;
}

Loading…
Cancel
Save