Skip to content

Commit

Permalink
fix: fix all lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed Aug 27, 2023
1 parent e9f6555 commit db766c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lib/src/screen_retriever.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class ScreenRetriever {
/// The shared instance of [ScreenRetriever].
static final ScreenRetriever instance = ScreenRetriever._();

// ignore: deprecated_member_use
double get devicePixelRatio => window.devicePixelRatio;

final MethodChannel _channel = const MethodChannel('screen_retriever');

final ObserverList<ScreenListener> _listeners =
Expand Down Expand Up @@ -55,7 +58,7 @@ class ScreenRetriever {

Future<Offset> getCursorScreenPoint() async {
final Map<String, dynamic> arguments = {
'devicePixelRatio': window.devicePixelRatio,
'devicePixelRatio': devicePixelRatio,
};
final Map<dynamic, dynamic> resultData =
await _channel.invokeMethod('getCursorScreenPoint', arguments);
Expand All @@ -67,7 +70,7 @@ class ScreenRetriever {

Future<Display> getPrimaryDisplay() async {
final Map<String, dynamic> arguments = {
'devicePixelRatio': window.devicePixelRatio,
'devicePixelRatio': devicePixelRatio,
};
final Map<dynamic, dynamic> resultData =
await _channel.invokeMethod('getPrimaryDisplay', arguments);
Expand All @@ -76,7 +79,7 @@ class ScreenRetriever {

Future<List<Display>> getAllDisplays() async {
final Map<String, dynamic> arguments = {
'devicePixelRatio': window.devicePixelRatio,
'devicePixelRatio': devicePixelRatio,
};
final Map<dynamic, dynamic> resultData =
await _channel.invokeMethod('getAllDisplays', arguments);
Expand Down
11 changes: 9 additions & 2 deletions test/screen_retriever_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ void main() {
}

setUp(() {
screenRetriever.channel.setMockMethodCallHandler(handleMockMethodCall);
TestDefaultBinaryMessengerBinding
.instance // wrap
.defaultBinaryMessenger
.setMockMethodCallHandler(
screenRetriever.channel, handleMockMethodCall);
});

tearDown(() {
screenRetriever.channel.setMockMethodCallHandler(null);
TestDefaultBinaryMessengerBinding
.instance // wrap
.defaultBinaryMessenger
.setMockMethodCallHandler(screenRetriever.channel, null);
});

test('should correctly parse output when calling getCursorScreenPoint',
Expand Down

0 comments on commit db766c3

Please sign in to comment.