Skip to content

Commit

Permalink
feat: updated lint, dart fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jhomlala committed Jul 7, 2024
1 parent da907e7 commit 4f04b09
Show file tree
Hide file tree
Showing 41 changed files with 119 additions and 119 deletions.
2 changes: 1 addition & 1 deletion packages/alice/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
#library_annotations: false
- require_trailing_commas
2 changes: 1 addition & 1 deletion packages/alice/lib/core/alice_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class AliceCore {
/// Save all calls to file.
Future<AliceExportResult> saveCallsToFile(BuildContext context) =>
AliceExportHelper.saveCallsToFile(
context, _configuration.aliceStorage.getCalls());
context, _configuration.aliceStorage.getCalls(),);

/// Adds new log to Alice logger.
void addLog(AliceLog log) => _configuration.aliceLogger.add(log);
Expand Down
4 changes: 2 additions & 2 deletions packages/alice/lib/core/alice_memory_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class AliceMemoryStorage implements AliceStorage {
redirects: calls
.where((AliceHttpCall call) =>
(call.response?.status.gte(300) ?? false) &&
(call.response?.status.lt(400) ?? false))
(call.response?.status.lt(400) ?? false),)
.length,
errors: calls
.where((AliceHttpCall call) =>
((call.response?.status.gte(400) ?? false) &&
(call.response?.status.lt(600) ?? false)) ||
const [-1, 0].contains(call.response?.status))
const [-1, 0].contains(call.response?.status),)
.length,
loading: calls.where((AliceHttpCall call) => call.loading).length,
);
Expand Down
6 changes: 3 additions & 3 deletions packages/alice/lib/core/alice_translations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class AliceTranslations {
AliceTranslationKey.accept: "Accept",
AliceTranslationKey.parserFailed: "Failed to parse: ",
AliceTranslationKey.unknown: "Unknown",
});
},);
}

/// Builds [AliceTranslationData] for polish language.
Expand Down Expand Up @@ -339,8 +339,8 @@ class AliceTranslations {
AliceTranslationKey.saveLogCurl: "Curl",
AliceTranslationKey.accept: "Akceptuj",
AliceTranslationKey.parserFailed: "Problem z parsowaniem: ",
AliceTranslationKey.unknown: "Nieznane"
});
AliceTranslationKey.unknown: "Nieznane",
},);
}

/// Returns localized value for specific [languageCode] and [key]. If value
Expand Down
4 changes: 2 additions & 2 deletions packages/alice/lib/helper/alice_export_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class AliceExportHelper {
try {
if (calls.isEmpty) {
return AliceExportResult(
success: false, error: AliceExportResultError.empty);
success: false, error: AliceExportResultError.empty,);
}

final Directory externalDir = await getApplicationCacheDirectory();
Expand Down Expand Up @@ -192,7 +192,7 @@ class AliceExportHelper {

if (call.error?.stackTrace != null) {
stringBuffer.write(
'${context.i18n(AliceTranslationKey.saveLogStackTrace)}: ${call.error?.stackTrace}\n');
'${context.i18n(AliceTranslationKey.saveLogStackTrace)}: ${call.error?.stackTrace}\n',);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/alice/lib/model/alice_http_call.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ class AliceHttpCall with EquatableMixin {
duration,
request,
response,
error
error,
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AliceCallErrorScreen extends StatelessWidget {
children: [
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callErrorScreenError),
value: errorText),
value: errorText,),
if (stackTrace != null)
AliceCallExpandableListRow(
name: context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class AliceCallOverviewScreen extends StatelessWidget {
),
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callOverviewClient),
value: call.client),
value: call.client,),
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callOverviewSecure),
value: call.secure.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,46 @@ class AliceCallRequestScreen extends StatelessWidget {
final List<Widget> rows = [
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callRequestStarted),
value: call.request?.time.toString()),
value: call.request?.time.toString(),),
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callRequestBytesSent),
value: AliceConversionHelper.formatBytes(call.request?.size ?? 0)),
value: AliceConversionHelper.formatBytes(call.request?.size ?? 0),),
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callRequestContentType),
value: AliceParser.getContentType(
context: context, headers: call.request?.headers)),
context: context, headers: call.request?.headers,),),
];

rows.add(AliceCallListRow(
name: context.i18n(AliceTranslationKey.callRequestBody),
value: _getBodyContent(
context: context,
),
));
),);

final List<AliceFormDataField>? formDataFields =
call.request?.formDataFields;
if (formDataFields?.isNotEmpty ?? false) {
rows.add(AliceCallListRow(
name: context.i18n(AliceTranslationKey.callRequestFormDataFields),
value: ''));
value: '',),);
rows.addAll([
for (final AliceFormDataField field in formDataFields!)
AliceCallListRow(name: ' • ${field.name}:', value: field.value)
AliceCallListRow(name: ' • ${field.name}:', value: field.value),
]);
}

final List<AliceFormDataFile>? formDataFiles = call.request!.formDataFiles;
if (formDataFiles?.isNotEmpty ?? false) {
rows.add(AliceCallListRow(
name: context.i18n(AliceTranslationKey.callRequestFormDataFiles),
value: ''));
value: '',),);
rows.addAll([
for (final AliceFormDataFile file in formDataFiles!)
AliceCallListRow(
name: ' • ${file.fileName}:',
value: '${file.contentType} / ${file.length} B',
)
),
]);
}

Expand All @@ -71,11 +71,11 @@ class AliceCallRequestScreen extends StatelessWidget {
: '';
rows.add(AliceCallListRow(
name: context.i18n(AliceTranslationKey.callRequestHeaders),
value: headersContent));
value: headersContent,),);
rows.addAll([
for (final MapEntry<String, dynamic> header in headers?.entries ?? [])
AliceCallListRow(
name: ' • ${header.key}:', value: header.value.toString())
name: ' • ${header.key}:', value: header.value.toString(),),
]);

final Map<String, dynamic>? queryParameters = call.request?.queryParameters;
Expand All @@ -84,12 +84,12 @@ class AliceCallRequestScreen extends StatelessWidget {
: '';
rows.add(AliceCallListRow(
name: context.i18n(AliceTranslationKey.callRequestQueryParameters),
value: queryParametersContent));
value: queryParametersContent,),);
rows.addAll([
for (final MapEntry<String, dynamic> queryParam
in queryParameters?.entries ?? [])
AliceCallListRow(
name: ' • ${queryParam.key}:', value: queryParam.value.toString())
name: ' • ${queryParam.key}:', value: queryParam.value.toString(),),
]);

return Container(
Expand All @@ -109,7 +109,7 @@ class AliceCallRequestScreen extends StatelessWidget {
context: context,
body: body,
contentType: AliceParser.getContentType(
context: context, headers: call.request?.headers),
context: context, headers: call.request?.headers,),
)
: context.i18n(AliceTranslationKey.callRequestBodyEmpty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class AliceCallResponseScreen extends StatelessWidget {
child: ListView(children: [
_GeneralDataColumn(call: call),
_HeaderDataColumn(call: call),
_BodyDataColumn(call: call)
]),
_BodyDataColumn(call: call),
],),
),
);
} else {
Expand Down Expand Up @@ -58,7 +58,7 @@ class _GeneralDataColumn extends StatelessWidget {
children: [
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callResponseReceived),
value: call.response?.time.toString()),
value: call.response?.time.toString(),),
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callResponseBytesReceived),
value: AliceConversionHelper.formatBytes(call.response?.size ?? 0),
Expand Down Expand Up @@ -89,12 +89,12 @@ class _HeaderDataColumn extends StatelessWidget {
children: [
AliceCallListRow(
name: context.i18n(AliceTranslationKey.callResponseHeaders),
value: headersContent),
value: headersContent,),
for (final MapEntry<String, String> header in headers?.entries ?? [])
AliceCallListRow(
name: ' • ${header.key}:',
value: header.value.toString(),
)
),
],
);
}
Expand Down Expand Up @@ -177,7 +177,7 @@ class _BodyDataColumnState extends State<_BodyDataColumn> {
/// Parses headers and returns content type of response. It may return null.
String? _getContentTypeOfResponse() {
return AliceParser.getContentType(
context: context, headers: call.response?.headers);
context: context, headers: call.response?.headers,);
}

/// Checks whether response body is large (more than [_largeOutputSize].
Expand Down Expand Up @@ -300,7 +300,7 @@ class _LargeTextBody extends StatelessWidget {
AliceTranslationKey.callResponseLargeBodyShowWarning,
),
),
]);
],);
}
}
}
Expand All @@ -322,7 +322,7 @@ class _TextBody extends StatelessWidget {
);
return AliceCallListRow(
name: context.i18n(AliceTranslationKey.callResponseBody),
value: bodyContent);
value: bodyContent,);
}
}

Expand All @@ -347,7 +347,7 @@ class _VideoBody extends StatelessWidget {
const SizedBox(height: 8),
TextButton(
child: Text(context
.i18n(AliceTranslationKey.callResponseBodyVideoWebBrowser)),
.i18n(AliceTranslationKey.callResponseBodyVideoWebBrowser),),
onPressed: () async {
await launchUrl(Uri.parse(call.uri));
},
Expand Down Expand Up @@ -388,7 +388,7 @@ class _UnknownBody extends StatelessWidget {
);
return AliceCallListRow(
name: context.i18n(AliceTranslationKey.callResponseBody),
value: bodyContent);
value: bodyContent,);
} else {
return Column(
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class _ContextMenuButton extends StatelessWidget {
Text(_getTitle(
context: context,
itemType: item,
)),
),),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class _ResponseStatus extends StatelessWidget {
fontSize: 16,
color: color,
),
)
),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,41 @@ class AliceCallsListScreen extends StatelessWidget {
AliceCallsListSortOption.time => sortAscending
? (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call1.createdTime.compareTo(call2.createdTime)))
call1.createdTime.compareTo(call2.createdTime),))
: (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call2.createdTime.compareTo(call1.createdTime))),
call2.createdTime.compareTo(call1.createdTime),)),
AliceCallsListSortOption.responseTime => sortAscending
? (calls
..sort()
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call1.response?.time.compareTo(call2.response!.time) ?? -1))
call1.response?.time.compareTo(call2.response!.time) ?? -1,))
: (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call2.response?.time.compareTo(call1.response!.time) ?? -1)),
call2.response?.time.compareTo(call1.response!.time) ?? -1,)),
AliceCallsListSortOption.responseCode => sortAscending
? (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call1.response?.status?.compareTo(call2.response!.status!) ??
-1))
-1,))
: (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call2.response?.status?.compareTo(call1.response!.status!) ??
-1)),
-1,)),
AliceCallsListSortOption.responseSize => sortAscending
? (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call1.response?.size.compareTo(call2.response!.size) ?? -1))
call1.response?.size.compareTo(call2.response!.size) ?? -1,))
: (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call2.response?.size.compareTo(call1.response!.size) ?? -1)),
call2.response?.size.compareTo(call1.response!.size) ?? -1,)),
AliceCallsListSortOption.endpoint => sortAscending
? (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call1.endpoint.compareTo(call2.endpoint)))
call1.endpoint.compareTo(call2.endpoint),))
: (calls
..sort((AliceHttpCall call1, AliceHttpCall call2) =>
call2.endpoint.compareTo(call1.endpoint))),
call2.endpoint.compareTo(call1.endpoint),)),
_ => calls,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class _AliceInspectorScreenState extends State<AliceInspectorScreen>
final String query = widget.queryTextEditingController.text.trim();
if (query.isNotEmpty) {
calls.removeWhere((AliceHttpCall call) =>
!call.endpoint.toLowerCase().contains(query.toLowerCase()));
!call.endpoint.toLowerCase().contains(query.toLowerCase()),);
}
if (calls.isNotEmpty) {
return AliceCallsListScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class _AliceLogListWidgetState extends State<AliceLogListWidget> {

final List<AliceLog> filteredLogs = [
for (final AliceLog log in logs)
if (log.level.index >= _minLevel.index) log
if (log.level.index >= _minLevel.index) log,
];

return ScrollConfiguration(
Expand Down Expand Up @@ -98,7 +98,7 @@ class _AliceLogEntryWidget extends StatelessWidget {
),
TextSpan(text: ' ${log.message}'),
..._toText(context, context.i18n(AliceTranslationKey.logsItemError),
log.error),
log.error,),
..._toText(
context,
context.i18n(AliceTranslationKey.logsItemStackTrace),
Expand Down
2 changes: 1 addition & 1 deletion packages/alice/lib/ui/common/alice_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AliceGeneralDialog {
Navigator.of(context).pop();
},
child: Text(secondButtonTitle),
)
),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/alice/lib/ui/common/alice_navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AliceNavigation {
required AliceCore core,
}) {
return _navigateToPage(
core: core, child: AliceCallDetailsPage(call: call, core: core));
core: core, child: AliceCallDetailsPage(call: call, core: core),);
}

/// Navigates to stats page.
Expand Down
Loading

0 comments on commit 4f04b09

Please sign in to comment.