Skip to content

Commit 57b5a71

Browse files
committed
🎨 Fixed minor issues
1 parent 42af3cd commit 57b5a71

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

lib/chopper/json_serializable_converter.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,23 @@ class JsonSerializableConverter extends JsonConverter {
2121
/// User: User.fromJson,
2222
/// NoContent: NoContent.fromJson,
2323
/// });
24+
/// ```
2425
final Map<Type, JsonFactory<dynamic>> factories;
2526

2627
T _decodeMap<T>(Map<String, dynamic> values) {
2728
final jsonFactory = factories[T];
2829
if (jsonFactory == null) {
29-
throw JsonUnsupportedObjectError(T,
30-
cause:
31-
'No fromJson was registered for JsonSerializableConverter for $T');
30+
throw JsonUnsupportedObjectError(
31+
T,
32+
cause:
33+
'No fromJson was registered for JsonSerializableConverter for $T',
34+
);
3235
}
3336
if (jsonFactory is! JsonFactory<T>) {
34-
throw JsonUnsupportedObjectError(T,
35-
cause: 'fromJson type does not match $T');
37+
throw JsonUnsupportedObjectError(
38+
T,
39+
cause: 'fromJson type does not match $T',
40+
);
3641
}
3742

3843
return jsonFactory(values);

lib/common/dcc_logger.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ class DCCLogger {
3232
: record.message;
3333

3434
debugPrint(_formatLogPrint(record, message));
35-
if (error != null)
35+
36+
if (error != null) {
3637
debugPrint(_formatLogPrint(record, '${error.runtimeType}: $error'));
38+
}
39+
3740
if (stacktrace != null) {
3841
final lines =
3942
stacktrace.toString().split('\n').where((e) => e.isNotEmpty);

lib/common/result/result.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:flutter/cupertino.dart';
1+
import 'package:flutter/foundation.dart';
22

33
/// Result class to handle success, failure and loading states.
44
@immutable

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ dependencies:
2121
dev_dependencies:
2222
flutter_test:
2323
sdk: flutter
24-
mocktail: ^1.0.2
2524
http: ^1.1.2
25+
mocktail: ^1.0.2
2626
parameterized_test: ^1.1.1
2727
very_good_analysis: ^5.1.0
2828

test/chopper/json_serializable_converter_test.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ void main() {
1313

1414
const converter = JsonSerializableConverter({});
1515

16-
expect(() => converter.convertResponse<TestModel, TestModel>(response),
17-
throwsA(isA<JsonUnsupportedObjectError>()));
16+
expect(
17+
() => converter.convertResponse<TestModel, TestModel>(response),
18+
throwsA(isA<JsonUnsupportedObjectError>()),
19+
);
1820
});
1921

2022
test('Error is thrown when wrong factory is added', () {
@@ -23,8 +25,10 @@ void main() {
2325
const converter =
2426
JsonSerializableConverter({TestModel: TestModel2.fromJson});
2527

26-
expect(() => converter.convertResponse<TestModel, TestModel>(response),
27-
throwsA(isA<JsonUnsupportedObjectError>()));
28+
expect(
29+
() => converter.convertResponse<TestModel, TestModel>(response),
30+
throwsA(isA<JsonUnsupportedObjectError>()),
31+
);
2832
});
2933

3034
test('Uses model to convert json into model', () async {

test/dcc_logger_test.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ void main() {
99
group('uninitialised tests', () {
1010
test('throws assertion error when logger is not initialised', () {
1111
expect(
12-
() => DCCLogger.info('test message'), throwsA(isA<AssertionError>()));
13-
expect(() => DCCLogger.severe('test message'),
14-
throwsA(isA<AssertionError>()));
12+
() => DCCLogger.info('test message'),
13+
throwsA(isA<AssertionError>()),
14+
);
15+
expect(
16+
() => DCCLogger.severe('test message'),
17+
throwsA(isA<AssertionError>()),
18+
);
1519
});
1620
});
1721

0 commit comments

Comments
 (0)