Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/camera/camera/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,13 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
Widget _cameraTogglesRowWidget() {
final List<Widget> toggles = <Widget>[];

final Null Function(CameraDescription? description) onChanged =
(CameraDescription? description) {
void onChanged(CameraDescription? description) {
if (description == null) {
return;
}

onNewCameraSelected(description);
};
}

if (_cameras.isEmpty) {
_ambiguate(SchedulerBinding.instance)?.addPostFrameCallback((_) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ void main() {
});

group('dispose', () {
testWidgets('resets the video element\'s source',
testWidgets("resets the video element's source",
(WidgetTester tester) async {
final Camera camera = Camera(
textureId: textureId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void main() {
isA<CameraException>().having(
(CameraException e) => e.code,
'code',
exception.code.toString(),
exception.code,
),
),
);
Expand Down Expand Up @@ -759,7 +759,7 @@ void main() {
isA<PlatformException>().having(
(PlatformException e) => e.code,
'code',
exception.name.toString(),
exception.name,
),
),
);
Expand Down Expand Up @@ -2495,7 +2495,7 @@ void main() {
equals(
CameraErrorEvent(
cameraId,
'Error code: ${CameraErrorCode.abort}, error message: The video element\'s source has not fully loaded.',
"Error code: ${CameraErrorCode.abort}, error message: The video element's source has not fully loaded.",
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ class FakeElementStream<T extends Event> extends Fake
final Stream<T> _stream;

@override
StreamSubscription<T> listen(void onData(T event)?,
{Function? onError, void onDone()?, bool? cancelOnError}) {
StreamSubscription<T> listen(void Function(T event)? onData,
{Function? onError, void Function()? onDone, bool? cancelOnError}) {
return _stream.listen(
onData,
onError: onError,
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_web/lib/src/camera_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CameraService {
throw CameraWebException(
cameraId,
CameraErrorCode.type,
'The camera options are incorrect or attempted'
'The camera options are incorrect or attempted '
'to access the media input from an insecure context.',
);
case 'AbortError':
Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera_web/lib/src/camera_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class CameraPlugin extends CameraPlatform {
cameraEventStreamController.add(
CameraErrorEvent(
cameraId,
'Error code: ${CameraErrorCode.abort}, error message: The video element\'s source has not fully loaded.',
"Error code: ${CameraErrorCode.abort}, error message: The video element's source has not fully loaded.",
),
);
});
Expand Down Expand Up @@ -400,7 +400,7 @@ class CameraPlugin extends CameraPlatform {
// This wrapper allows use of both the old and new APIs.
dynamic fullScreen() => documentElement.requestFullscreen();
await fullScreen();
await screenOrientation.lock(orientationType.toString());
await screenOrientation.lock(orientationType);
} else {
throw PlatformException(
code: CameraErrorCode.orientationNotSupported.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,12 @@ class FakeFileSelector extends Fake
this.confirmButtonText = confirmButtonText;
}

// ignore: use_setters_to_change_properties
void setFileResponse(List<XFile> files) {
this.files = files;
}

// ignore: use_setters_to_change_properties
void setPathResponse(String path) {
this.path = path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ void main() {
testWidgets('works', (WidgetTester _) async {
final XFile mockFile = createXFile('1001', 'identity.png');

final MockDomHelper mockDomHelper = MockDomHelper()
..setFiles(<XFile>[mockFile])
..expectAccept('.jpg,.jpeg,image/png,image/*')
..expectMultiple(false);
final MockDomHelper mockDomHelper = MockDomHelper(
files: <XFile>[mockFile],
expectAccept: '.jpg,.jpeg,image/png,image/*',
expectMultiple: false);

final FileSelectorWeb plugin =
FileSelectorWeb(domHelper: mockDomHelper);
Expand All @@ -49,10 +49,10 @@ void main() {
final XFile mockFile1 = createXFile('123456', 'file1.txt');
final XFile mockFile2 = createXFile('', 'file2.txt');

final MockDomHelper mockDomHelper = MockDomHelper()
..setFiles(<XFile>[mockFile1, mockFile2])
..expectAccept('.txt')
..expectMultiple(true);
final MockDomHelper mockDomHelper = MockDomHelper(
files: <XFile>[mockFile1, mockFile2],
expectAccept: '.txt',
expectMultiple: true);

final FileSelectorWeb plugin =
FileSelectorWeb(domHelper: mockDomHelper);
Expand Down Expand Up @@ -90,9 +90,17 @@ void main() {
}

class MockDomHelper implements DomHelper {
List<XFile> _files = <XFile>[];
String _expectedAccept = '';
bool _expectedMultiple = false;
MockDomHelper({
List<XFile> files = const <XFile>[],
String expectAccept = '',
bool expectMultiple = false,
}) : _files = files,
_expectedAccept = expectAccept,
_expectedMultiple = expectMultiple;

final List<XFile> _files;
final String _expectedAccept;
final bool _expectedMultiple;

@override
Future<List<XFile>> getFiles({
Expand All @@ -106,18 +114,6 @@ class MockDomHelper implements DomHelper {
reason: 'Expected "multiple" value does not match.');
return Future<List<XFile>>.value(_files);
}

void setFiles(List<XFile> files) {
_files = files;
}

void expectAccept(String accept) {
_expectedAccept = accept;
}

void expectMultiple(bool multiple) {
_expectedMultiple = multiple;
}
}

XFile createXFile(String content, String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ void _assertTypeGroupIsValid(XTypeGroup group) {

/// Append a dot at the beggining if it is not there png -> .png
String _normalizeExtension(String ext) {
return ext.isNotEmpty && ext[0] != '.' ? '.' + ext : ext;
return ext.isNotEmpty && ext[0] != '.' ? '.$ext' : ext;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AnimateCamera extends StatefulWidget {
class AnimateCameraState extends State<AnimateCamera> {
GoogleMapController? mapController;

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
mapController = controller;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class MoveCamera extends StatefulWidget {
class MoveCameraState extends State<MoveCamera> {
GoogleMapController? mapController;

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
mapController = controller;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class PlaceCircleBodyState extends State<PlaceCircleBody> {
int widthsIndex = 0;
List<int> widths = <int>[10, 20, 5];

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
this.controller = controller;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class PlaceMarkerBodyState extends State<PlaceMarkerBody> {
int _markerIdCounter = 1;
LatLng? markerPosition;

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
this.controller = controller;
}
Expand Down Expand Up @@ -207,7 +208,7 @@ class PlaceMarkerBodyState extends State<PlaceMarkerBody> {

Future<void> _changeInfo(MarkerId markerId) async {
final Marker marker = markers[markerId]!;
final String newSnippet = marker.infoWindow.snippet! + '*';
final String newSnippet = '${marker.infoWindow.snippet!}*';
setState(() {
markers[markerId] = marker.copyWith(
infoWindowParam: marker.infoWindow.copyWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class PlacePolygonBodyState extends State<PlacePolygonBody> {
int widthsIndex = 0;
List<int> widths = <int>[10, 20, 5];

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
this.controller = controller;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class PlacePolylineBodyState extends State<PlacePolylineBody> {
<PatternItem>[PatternItem.dot, PatternItem.gap(10.0)],
];

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
this.controller = controller;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ScrollingMapBody extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 30.0),
child: Column(
children: <Widget>[
const Text('This map doesn\'t consume the vertical drags.'),
const Text("This map doesn't consume the vertical drags."),
const Padding(
padding: EdgeInsets.only(bottom: 12.0),
child:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class _SnapshotBodyState extends State<_SnapshotBody> {
);
}

// ignore: use_setters_to_change_properties
void onMapCreated(GoogleMapController controller) {
_mapController = controller;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class TileOverlayBodyState extends State<TileOverlayBody> {
GoogleMapController? controller;
TileOverlay? _tileOverlay;

// ignore: use_setters_to_change_properties
void _onMapCreated(GoogleMapController controller) {
this.controller = controller;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void main() {
expect(plugin.init(hostedDomain: ''), throwsAssertionError);
});

testWidgets('Init doesn\'t accept spaces in scopes',
testWidgets("Init doesn't accept spaces in scopes",
(WidgetTester tester) async {
expect(
plugin.init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ class FakeGoogleUser extends Fake implements gapi.GoogleUser {
@override
gapi.BasicProfile? getBasicProfile() => _basicProfile;

// ignore: use_setters_to_change_properties
void setIsSignedIn(bool isSignedIn) {
_isSignedIn = isSignedIn;
}

// ignore: use_setters_to_change_properties
void setBasicProfile(gapi.BasicProfile basicProfile) {
_basicProfile = basicProfile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import 'dart:convert';

String toBase64Url(String contents) {
// Open the file
return 'data:text/javascript;base64,' + base64.encode(utf8.encode(contents));
return 'data:text/javascript;base64,${base64.encode(utf8.encode(contents))}';
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class GoogleSignInPlugin extends GoogleSignInPlatform {

assert(
!scopes.any((String scope) => scope.contains(' ')),
'OAuth 2.0 Scopes for Google APIs can\'t contain spaces.'
"OAuth 2.0 Scopes for Google APIs can't contain spaces. "
'Check https://developers.google.com/identity/protocols/googlescopes '
'for a list of valid OAuth 2.0 scopes.');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class GoogleAuth {

/// Calls the onInit function when the GoogleAuth object is fully initialized, or calls the onFailure function if
/// initialization fails.
external dynamic then(dynamic onInit(GoogleAuth googleAuth),
[dynamic onFailure(GoogleAuthInitFailureError reason)]);
external dynamic then(dynamic Function(GoogleAuth googleAuth) onInit,
[dynamic Function(GoogleAuthInitFailureError reason) onFailure]);

/// Signs out all accounts from the application.
external dynamic signOut();
Expand All @@ -70,8 +70,8 @@ class GoogleAuth {
external dynamic attachClickHandler(
dynamic container,
SigninOptions options,
dynamic onsuccess(GoogleUser googleUser),
dynamic onfailure(String reason));
dynamic Function(GoogleUser googleUser) onsuccess,
dynamic Function(String reason) onfailure);
}

@anonymous
Expand Down Expand Up @@ -104,7 +104,7 @@ abstract class IsSignedIn {
external bool get();

/// Listen for changes in the current user's sign-in state.
external void listen(dynamic listener(bool signedIn));
external void listen(dynamic Function(bool signedIn) listener);
}

@anonymous
Expand All @@ -116,7 +116,7 @@ abstract class CurrentUser {
external GoogleUser get();

/// Listen for changes in currentUser.
external void listen(dynamic listener(GoogleUser user));
external void listen(dynamic Function(GoogleUser user) listener);
}

@anonymous
Expand Down Expand Up @@ -440,7 +440,7 @@ external GoogleAuth? getAuthInstance();
/// Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeparams-callback
@JS('gapi.auth2.authorize')
external void authorize(
AuthorizeConfig params, void callback(AuthorizeResponse response));
AuthorizeConfig params, void Function(AuthorizeResponse response) callback);
// End module gapi.auth2

// Module gapi.signin2
Expand Down Expand Up @@ -497,6 +497,7 @@ external void render(
@JS()
abstract class Promise<T> {
external factory Promise(
void executor(void resolve(T result), Function reject));
external Promise then(void onFulfilled(T result), [Function onRejected]);
void Function(void Function(T result) resolve, Function reject) executor);
external Promise then(void Function(T result) onFulfilled,
[Function onRejected]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Future<void> injectJSLibraries(
final html.ScriptElement script = html.ScriptElement()
..async = true
..defer = true
// ignore: unsafe_html
..src = library;
// TODO(ditman): add a timeout race to fail this future
loading.add(script.onLoad.first);
Expand Down
11 changes: 7 additions & 4 deletions packages/image_picker/image_picker/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
List<XFile>? _imageFileList;

set _imageFile(XFile? value) {
void _setImageFileListFromFile(XFile? value) {
_imageFileList = value == null ? null : <XFile>[value];
}

Expand Down Expand Up @@ -118,7 +118,7 @@ class _MyHomePageState extends State<MyHomePage> {
imageQuality: quality,
);
setState(() {
_imageFile = pickedFile;
_setImageFileListFromFile(pickedFile);
});
} catch (e) {
setState(() {
Expand Down Expand Up @@ -228,8 +228,11 @@ class _MyHomePageState extends State<MyHomePage> {
} else {
isVideo = false;
setState(() {
_imageFile = response.file;
_imageFileList = response.files;
if (response.files == null) {
_setImageFileListFromFile(response.file);
} else {
_imageFileList = response.files;
}
});
}
} else {
Expand Down
Loading