Skip to content

Commit deea6a0

Browse files
committed
Formatted code
1 parent 92966de commit deea6a0

File tree

4 files changed

+78
-47
lines changed

4 files changed

+78
-47
lines changed

packages/camera/camera_platform_interface/lib/src/events/camera_event.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ abstract class CameraEvent {
3232

3333
@override
3434
bool operator ==(Object other) =>
35-
identical(this, other) || other is CameraEvent && runtimeType == other.runtimeType && cameraId == other.cameraId;
35+
identical(this, other) ||
36+
other is CameraEvent &&
37+
runtimeType == other.runtimeType &&
38+
cameraId == other.cameraId;
3639

3740
@override
3841
int get hashCode => cameraId.hashCode;
@@ -164,7 +167,8 @@ class CameraResolutionChangedEvent extends CameraEvent {
164167
captureHeight == other.captureHeight;
165168

166169
@override
167-
int get hashCode => super.hashCode ^ captureWidth.hashCode ^ captureHeight.hashCode;
170+
int get hashCode =>
171+
super.hashCode ^ captureWidth.hashCode ^ captureHeight.hashCode;
168172
}
169173

170174
/// An event fired when the camera is going to close.
@@ -175,7 +179,8 @@ class CameraClosingEvent extends CameraEvent {
175179

176180
/// Converts the supplied [Map] to an instance of the [CameraClosingEvent]
177181
/// class.
178-
CameraClosingEvent.fromJson(Map<String, dynamic> json) : super(json['cameraId']);
182+
CameraClosingEvent.fromJson(Map<String, dynamic> json)
183+
: super(json['cameraId']);
179184

180185
/// Converts the [CameraClosingEvent] instance into a [Map] instance that can
181186
/// be serialized to JSON.
@@ -185,7 +190,10 @@ class CameraClosingEvent extends CameraEvent {
185190

186191
@override
187192
bool operator ==(Object other) =>
188-
identical(this, other) || super == (other) && other is CameraClosingEvent && runtimeType == other.runtimeType;
193+
identical(this, other) ||
194+
super == (other) &&
195+
other is CameraClosingEvent &&
196+
runtimeType == other.runtimeType;
189197

190198
@override
191199
int get hashCode => super.hashCode;

packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ abstract class CameraPlatform extends PlatformInterface {
168168
throw UnimplementedError('setFocusPoint() is not implemented.');
169169
}
170170

171-
172171
/// Gets the maximum supported zoom level for the selected camera.
173172
Future<double> getMaxZoomLevel(int cameraId) {
174173
throw UnimplementedError('getMaxZoomLevel() is not implemented.');

packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -266,29 +266,29 @@ void main() {
266266

267267
test(
268268
'Default implementation of setFocusMode() should throw unimplemented error',
269-
() {
270-
// Arrange
271-
final cameraPlatform = ExtendsCameraPlatform();
269+
() {
270+
// Arrange
271+
final cameraPlatform = ExtendsCameraPlatform();
272272

273-
// Act & Assert
274-
expect(
275-
() => cameraPlatform.setFocusMode(1, null),
276-
throwsUnimplementedError,
277-
);
278-
});
273+
// Act & Assert
274+
expect(
275+
() => cameraPlatform.setFocusMode(1, null),
276+
throwsUnimplementedError,
277+
);
278+
});
279279

280280
test(
281281
'Default implementation of setFocusPoint() should throw unimplemented error',
282-
() {
283-
// Arrange
284-
final cameraPlatform = ExtendsCameraPlatform();
285-
286-
// Act & Assert
287-
expect(
288-
() => cameraPlatform.setFocusPoint(1, null),
289-
throwsUnimplementedError,
290-
);
291-
});
282+
() {
283+
// Arrange
284+
final cameraPlatform = ExtendsCameraPlatform();
285+
286+
// Act & Assert
287+
expect(
288+
() => cameraPlatform.setFocusPoint(1, null),
289+
throwsUnimplementedError,
290+
);
291+
});
292292

293293
test(
294294
'Default implementation of startVideoRecording() should throw unimplemented error',

packages/camera/camera_platform_interface/test/events/camera_event_test.dart

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ void main() {
1212

1313
group('CameraInitializedEvent tests', () {
1414
test('Constructor should initialize all properties', () {
15-
final event = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
15+
final event = CameraInitializedEvent(
16+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
1617

1718
expect(event.cameraId, 1);
1819
expect(event.previewWidth, 1024);
@@ -44,7 +45,8 @@ void main() {
4445
});
4546

4647
test('toJson should return a map with all fields', () {
47-
final event = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
48+
final event = CameraInitializedEvent(
49+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
4850

4951
final jsonMap = event.toJson();
5052

@@ -59,63 +61,81 @@ void main() {
5961
});
6062

6163
test('equals should return true if objects are the same', () {
62-
final firstEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
63-
final secondEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
64+
final firstEvent = CameraInitializedEvent(
65+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
66+
final secondEvent = CameraInitializedEvent(
67+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
6468

6569
expect(firstEvent == secondEvent, true);
6670
});
6771

6872
test('equals should return false if cameraId is different', () {
69-
final firstEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
70-
final secondEvent = CameraInitializedEvent(2, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
73+
final firstEvent = CameraInitializedEvent(
74+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
75+
final secondEvent = CameraInitializedEvent(
76+
2, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
7177

7278
expect(firstEvent == secondEvent, false);
7379
});
7480

7581
test('equals should return false if previewWidth is different', () {
76-
final firstEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
77-
final secondEvent = CameraInitializedEvent(1, 2048, 640, ExposureMode.auto, FocusMode.auto, true, true);
82+
final firstEvent = CameraInitializedEvent(
83+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
84+
final secondEvent = CameraInitializedEvent(
85+
1, 2048, 640, ExposureMode.auto, FocusMode.auto, true, true);
7886

7987
expect(firstEvent == secondEvent, false);
8088
});
8189

8290
test('equals should return false if previewHeight is different', () {
83-
final firstEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
84-
final secondEvent = CameraInitializedEvent(1, 1024, 980, ExposureMode.auto, FocusMode.auto, true, true);
91+
final firstEvent = CameraInitializedEvent(
92+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
93+
final secondEvent = CameraInitializedEvent(
94+
1, 1024, 980, ExposureMode.auto, FocusMode.auto, true, true);
8595

8696
expect(firstEvent == secondEvent, false);
8797
});
8898

8999
test('equals should return false if exposureMode is different', () {
90-
final firstEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
91-
final secondEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.locked, FocusMode.auto, true, true);
100+
final firstEvent = CameraInitializedEvent(
101+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
102+
final secondEvent = CameraInitializedEvent(
103+
1, 1024, 640, ExposureMode.locked, FocusMode.auto, true, true);
92104

93105
expect(firstEvent == secondEvent, false);
94106
});
95107

96-
test('equals should return false if exposurePointSupported is different', () {
97-
final firstEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
98-
final secondEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, false, true);
108+
test('equals should return false if exposurePointSupported is different',
109+
() {
110+
final firstEvent = CameraInitializedEvent(
111+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
112+
final secondEvent = CameraInitializedEvent(
113+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, false, true);
99114

100115
expect(firstEvent == secondEvent, false);
101116
});
102117

103118
test('equals should return false if focusMode is different', () {
104-
final firstEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
105-
final secondEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.locked, true, true);
119+
final firstEvent = CameraInitializedEvent(
120+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
121+
final secondEvent = CameraInitializedEvent(
122+
1, 1024, 640, ExposureMode.auto, FocusMode.locked, true, true);
106123

107124
expect(firstEvent == secondEvent, false);
108125
});
109126

110127
test('equals should return false if focusPointSupported is different', () {
111-
final firstEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
112-
final secondEvent = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, false);
128+
final firstEvent = CameraInitializedEvent(
129+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
130+
final secondEvent = CameraInitializedEvent(
131+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, false);
113132

114133
expect(firstEvent == secondEvent, false);
115134
});
116135

117136
test('hashCode should match hashCode of all properties', () {
118-
final event = CameraInitializedEvent(1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
137+
final event = CameraInitializedEvent(
138+
1, 1024, 640, ExposureMode.auto, FocusMode.auto, true, true);
119139
final expectedHashCode = event.cameraId.hashCode ^
120140
event.previewWidth.hashCode ^
121141
event.previewHeight.hashCode ^
@@ -190,7 +210,9 @@ void main() {
190210

191211
test('hashCode should match hashCode of all properties', () {
192212
final event = CameraResolutionChangedEvent(1, 1024, 640);
193-
final expectedHashCode = event.cameraId.hashCode ^ event.captureWidth.hashCode ^ event.captureHeight.hashCode;
213+
final expectedHashCode = event.cameraId.hashCode ^
214+
event.captureWidth.hashCode ^
215+
event.captureHeight.hashCode;
194216

195217
expect(event.hashCode, expectedHashCode);
196218
});
@@ -251,7 +273,8 @@ void main() {
251273
});
252274

253275
test('fromJson should initialize all properties', () {
254-
final event = CameraErrorEvent.fromJson(<String, dynamic>{'cameraId': 1, 'description': 'Error'});
276+
final event = CameraErrorEvent.fromJson(
277+
<String, dynamic>{'cameraId': 1, 'description': 'Error'});
255278

256279
expect(event.cameraId, 1);
257280
expect(event.description, 'Error');
@@ -290,7 +313,8 @@ void main() {
290313

291314
test('hashCode should match hashCode of all properties', () {
292315
final event = CameraErrorEvent(1, 'Error');
293-
final expectedHashCode = event.cameraId.hashCode ^ event.description.hashCode;
316+
final expectedHashCode =
317+
event.cameraId.hashCode ^ event.description.hashCode;
294318

295319
expect(event.hashCode, expectedHashCode);
296320
});

0 commit comments

Comments
 (0)