Skip to content

Commit

Permalink
Merge pull request #29 from nohli/fix-pub.dev-score
Browse files Browse the repository at this point in the history
Fix pub.dev score
  • Loading branch information
pinkfish authored Jun 11, 2021
2 parents c3ae92f + 3ec7cc7 commit ece8f37
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.1

Improve pub.dev score

## 2.0.0

* Update gradle
Expand Down
4 changes: 2 additions & 2 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ void main() {
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) =>
widget is Text &&
(Widget widget) =>
widget is Text &&
widget.data?.startsWith('Local timezone:') == true,
),
findsOneWidget,
Expand Down
18 changes: 8 additions & 10 deletions lib/flutter_native_timezone_web.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:html' as html;

import 'package:flutter/services.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
Expand All @@ -12,9 +11,10 @@ import 'package:js/js.dart';
class FlutterNativeTimezonePlugin {
static void registerWith(Registrar registrar) {
final MethodChannel channel = MethodChannel(
'flutter_native_timezone',
const StandardMethodCodec(),
registrar.messenger);
'flutter_native_timezone',
const StandardMethodCodec(),
registrar,
);
final FlutterNativeTimezonePlugin instance = FlutterNativeTimezonePlugin();
channel.setMethodCallHandler(instance.handleMethodCall);
}
Expand All @@ -24,11 +24,12 @@ class FlutterNativeTimezonePlugin {
case 'getLocalTimezone':
return _getLocalTimeZone();
case 'getAvailableTimezones':
return [ _getLocalTimeZone() ];
return [_getLocalTimeZone()];
default:
throw PlatformException(
code: 'Unimplemented',
details: "The flutter_native_timezone plugin for web doesn't implement "
details:
"The flutter_native_timezone plugin for web doesn't implement "
"the method '${call.method}'");
}
}
Expand All @@ -37,9 +38,7 @@ class FlutterNativeTimezonePlugin {
/// local time zone when running on the web.
///
String _getLocalTimeZone() {
return jsDateTimeFormat()
.resolvedOptions()
.timeZone;
return jsDateTimeFormat().resolvedOptions().timeZone;
}
}

Expand All @@ -57,4 +56,3 @@ abstract class _JSResolvedOptions {
@JS()
external String get timeZone;
}

4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_native_timezone
description: A flutter plugin for getting the local timezone of the os.
version: 2.0.0
description: A flutter plugin for getting the local timezone of the device.
version: 2.0.1
homepage: https://github.com/pinkfish/flutter_native_timezone

environment:
Expand Down
2 changes: 1 addition & 1 deletion test/flutter_native_timezone_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter_test/flutter_test.dart';

void main() {
TestWidgetsFlutterBinding.ensureInitialized();

const MethodChannel channel = MethodChannel('flutter_native_timezone');

setUp(() {
Expand Down

0 comments on commit ece8f37

Please sign in to comment.