Skip to content

Commit

Permalink
Migrate to Dart 2.12 and Flutter 2.0 (flutter-tizen#50)
Browse files Browse the repository at this point in the history
* Update battery

* Update connectivity

* Update device_info

* Update image_picker

* Update integration_test

* Update package_info

* Update path_provider

* Update sensors

* Update share

* Update shared_preferences

* Update url_launcher

* Update wifi_info_flutter

* Update github workflow
  • Loading branch information
swift-kim authored Mar 30, 2021
1 parent 6342185 commit 690e198
Show file tree
Hide file tree
Showing 128 changed files with 1,058 additions and 1,431 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
flutter-version: "1.22.0"
flutter-version: "2.0.1"
- name: Install pub dependencies
run: |
for d in `pwd`/packages/*/; do
cd $d
flutter pub downgrade
flutter pub get
done
- name: Verify formatting
run: flutter format --set-exit-if-changed packages
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The _"non-endorsed"_ status means that the plugin is not endorsed by the origina
| [**connectivity_tizen**](packages/connectivity) | [connectivity](https://github.com/flutter/plugins/tree/master/packages/connectivity) (1st-party) | [![pub package](https://img.shields.io/pub/v/connectivity_tizen.svg)](https://pub.dev/packages/connectivity_tizen) | No |
| [**device_info_tizen**](packages/device_info) | [device_info](https://github.com/flutter/plugins/tree/master/packages/device_info) (1st-party) | [![pub package](https://img.shields.io/pub/v/device_info_tizen.svg)](https://pub.dev/packages/device_info_tizen) | No |
| [**image_picker_tizen**](packages/image_picker) | [image_picker](https://github.com/flutter/plugins/tree/master/packages/image_picker) (1st-party) | [![pub package](https://img.shields.io/pub/v/image_picker_tizen.svg)](https://pub.dev/packages/image_picker_tizen) | No |
| [**integration_test_tizen**](packages/integration_test) | [integration_test](https://github.com/flutter/plugins/tree/master/packages/integration_test) (1st-party) | [![pub package](https://img.shields.io/pub/v/integration_test_tizen.svg)](https://pub.dev/packages/integration_test_tizen) | No |
| [**integration_test_tizen**](packages/integration_test) | [integration_test](https://github.com/flutter/flutter/tree/master/packages/integration_test) (1st-party) | [![pub package](https://img.shields.io/pub/v/integration_test_tizen.svg)](https://pub.dev/packages/integration_test_tizen) | No |
| [**package_info_tizen**](packages/package_info) | [package_info](https://github.com/flutter/plugins/tree/master/packages/package_info) (1st-party) | [![pub package](https://img.shields.io/pub/v/package_info_tizen.svg)](https://pub.dev/packages/package_info_tizen) | No |
| [**path_provider_tizen**](packages/path_provider) | [path_provider](https://github.com/flutter/plugins/tree/master/packages/path_provider) (1st-party) | [![pub package](https://img.shields.io/pub/v/path_provider_tizen.svg)](https://pub.dev/packages/path_provider_tizen) | No |
| [**sensors_tizen**](packages/sensors) | [sensors](https://github.com/flutter/plugins/tree/master/packages/sensors) (1st-party) | [![pub package](https://img.shields.io/pub/v/sensors_tizen.svg)](https://pub.dev/packages/sensors_tizen) | No |
Expand Down
8 changes: 8 additions & 0 deletions packages/battery/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
## 1.0.1

* Port to use platform interface

## 2.0.0

* Update Dart and Flutter SDK constraints
* Update Flutter copyright information
* Update example and integration_test
* Update platform interface to 2.0.1
* Organize dev_dependencies
2 changes: 1 addition & 1 deletion packages/battery/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
Copyright (c) 2017 The Chromium Authors. All rights reserved.
Copyright (c) 2013 The Flutter Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down
4 changes: 2 additions & 2 deletions packages/battery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ This package is not an _endorsed_ implementation of `battery`. Therefore, you ha

```yaml
dependencies:
battery: ^1.0.11
battery_tizen: ^1.0.1
battery: ^2.0.1
battery_tizen: ^2.0.0
```
Then you can import `battery` in your Dart code:
Expand Down
8 changes: 5 additions & 3 deletions packages/battery/example/integration_test/battery_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9

import 'package:flutter_test/flutter_test.dart';
import 'package:battery/battery.dart';
Expand Down
15 changes: 7 additions & 8 deletions packages/battery/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand All @@ -21,13 +21,13 @@ class MyApp extends StatelessWidget {
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
const MyHomePage({Key? key, required this.title}) : super(key: key);

final String title;

Expand All @@ -36,10 +36,10 @@ class MyHomePage extends StatefulWidget {
}

class _MyHomePageState extends State<MyHomePage> {
Battery _battery = Battery();
final Battery _battery = Battery();

BatteryState _batteryState;
StreamSubscription<BatteryState> _batteryStateSubscription;
BatteryState? _batteryState;
late StreamSubscription<BatteryState> _batteryStateSubscription;

@override
void initState() {
Expand Down Expand Up @@ -71,7 +71,7 @@ class _MyHomePageState extends State<MyHomePage> {
builder: (_) => AlertDialog(
content: Text('Battery: $batteryLevel%'),
actions: <Widget>[
FlatButton(
TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.pop(context);
Expand All @@ -82,7 +82,6 @@ class _MyHomePageState extends State<MyHomePage> {
);
},
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
);
}

Expand Down
15 changes: 9 additions & 6 deletions packages/battery/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ description: Demonstrates how to use the battery_tizen plugin.
publish_to: 'none'

dependencies:
flutter:
sdk: flutter
battery: ^1.0.11
battery: ^2.0.1
battery_tizen:
path: ../
flutter:
sdk: flutter

dev_dependencies:
flutter_driver:
sdk: flutter
integration_test: ^1.0.1
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
integration_test_tizen:
path: ../../integration_test/

flutter:
uses-material-design: true

environment:
sdk: ">=2.2.2 <3.0.0"
flutter: ">=1.20.0 <2.0.0"
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"
2 changes: 2 additions & 0 deletions packages/battery/example/test_driver/integration_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @dart=2.9

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
12 changes: 4 additions & 8 deletions packages/battery/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: battery_tizen
description: Flutter plugin for accessing information about the battery state
(full, charging, discharging) on Tizen.
version: 1.0.1
version: 2.0.0
homepage: https://github.com/flutter-tizen/plugins

flutter:
Expand All @@ -12,14 +12,10 @@ flutter:
fileName: battery_tizen_plugin.h

dependencies:
battery_platform_interface: ^2.0.1
flutter:
sdk: flutter
battery_platform_interface: ^1.0.0

dev_dependencies:
flutter_test:
sdk: flutter

environment:
sdk: ">=2.2.2 <3.0.0"
flutter: ">=1.20.0 <2.0.0"
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"
11 changes: 10 additions & 1 deletion packages/connectivity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 1.0.0

* Initial release
* Initial release

## 2.0.0

* Update Dart and Flutter SDK constraints
* Update Flutter copyright information
* Update example and integration_test
* Update platform interface to 2.0.1
* Organize dev_dependencies
* Replace pointer-based `Success()` with reference-based version
2 changes: 1 addition & 1 deletion packages/connectivity/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Copyright (c) 2021 Samsung Electronics Co., Ltd. All rights reserved.
Copyright (c) 2017 The Chromium Authors. All rights reserved.
Copyright (c) 2013 The Flutter Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down
5 changes: 3 additions & 2 deletions packages/connectivity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ This package is not an _endorsed_ implementation of `connectivity`. Therefore, y

```yaml
dependencies:
connectivity: ^2.0.2
connectivity_tizen: ^1.0.0
connectivity: ^3.0.3
connectivity_tizen: ^2.0.0
```
Then you can import `connectivity` in your Dart code:

```dart
Expand Down
4 changes: 2 additions & 2 deletions packages/connectivity/example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# connectiviy example
# connectiviy_example

Demonstrates how to use the connectiviy plugin.
Demonstrates how to use the connectiviy_tizen plugin.

## Getting Started

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(cyanglaz): Remove once https://github.com/flutter/plugins/pull/3158 is landed.
// @dart = 2.9

import 'package:integration_test/integration_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:connectivity/connectivity.dart';
Expand Down
12 changes: 6 additions & 6 deletions packages/connectivity/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -34,13 +34,13 @@ class MyApp extends StatelessWidget {
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
const MyHomePage({Key? key, required this.title}) : super(key: key);

final String title;

Expand All @@ -51,7 +51,7 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
String _connectionStatus = 'Unknown';
final Connectivity _connectivity = Connectivity();
StreamSubscription<ConnectivityResult> _connectivitySubscription;
late StreamSubscription<ConnectivityResult> _connectivitySubscription;

@override
void initState() {
Expand All @@ -69,7 +69,7 @@ class _MyHomePageState extends State<MyHomePage> {

// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initConnectivity() async {
ConnectivityResult result;
ConnectivityResult result = ConnectivityResult.none;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
result = await _connectivity.checkConnectivity();
Expand All @@ -81,7 +81,7 @@ class _MyHomePageState extends State<MyHomePage> {
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) {
return Future.value(null);
return;
}

return _updateConnectionStatus(result);
Expand Down
18 changes: 10 additions & 8 deletions packages/connectivity/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
name: connectivity_example
description: Demonstrates how to use the connectivity plugin.
description: Demonstrates how to use the connectivity_tizen plugin.
publish_to: 'none'

dependencies:
flutter:
sdk: flutter
connectivity: ^2.0.2
connectivity: ^3.0.3
connectivity_tizen:
path: ../
flutter:
sdk: flutter

dev_dependencies:
flutter_driver:
sdk: flutter
test: any
integration_test: ^1.0.1
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
integration_test_tizen:
path: ../../integration_test/

flutter:
uses-material-design: true

environment:
sdk: ">=2.2.2 <3.0.0"
flutter: ">=1.20.0 <2.0.0"
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @dart=2.9

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
18 changes: 5 additions & 13 deletions packages/connectivity/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: connectivity_tizen
description: Flutter plugin for discovering the state of the network (WiFi) connectivity on Tizen.
version: 1.0.0
version: 2.0.0
homepage: https://github.com/flutter-tizen/plugins

flutter:
Expand All @@ -9,20 +9,12 @@ flutter:
tizen:
pluginClass: ConnectivityTizenPlugin
fileName: connectivity_tizen_plugin.h

dependencies:
connectivity: ^2.0.2
connectivity_platform_interface: ^1.0.6
connectivity_platform_interface: ^2.0.1
flutter:
sdk: flutter

dev_dependencies:
test: any
flutter_driver:
sdk: flutter
flutter_test:
sdk: flutter
mockito: ^4.1.1

environment:
sdk: ">=2.6.0 <3.0.0"
flutter: ">=1.20.0 <2.0.0"
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"
4 changes: 2 additions & 2 deletions packages/connectivity/tizen/src/connectivity_tizen_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ConnectivityTizenPlugin : public flutter::Plugin {
if (m_events == nullptr) return;
std::string replay = convertConnectionTypeToString(state);
flutter::EncodableValue msg(replay);
m_events->Success(&msg);
m_events->Success(msg);
}

private:
Expand Down Expand Up @@ -150,7 +150,7 @@ class ConnectivityTizenPlugin : public flutter::Plugin {
}

flutter::EncodableValue msg(replay);
result->Success(&msg);
result->Success(msg);
}
connection_h m_connection;
std::unique_ptr<flutter::EventSink<flutter::EncodableValue>> m_events;
Expand Down
13 changes: 12 additions & 1 deletion packages/device_info/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 1.0.0

* Initial release
* Initial release

## 2.0.0

* Update Dart and Flutter SDK constraints
* Update Flutter copyright information
* Update example and integration_test
* Update platform interface to 2.0.1
* Organize dev_dependencies
* Migrate to null safety
* Add missing documentation
* Resolve the visibility warning (`channel` is visible for testing purposes only)
Loading

0 comments on commit 690e198

Please sign in to comment.