Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[wifi_info_flutter] null safety stable #3627

Merged
merged 3 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/wifi_info_flutter/wifi_info_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 2.0.0-nullsafety
## 2.0.0

* Migrate to null safety.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MyApp extends StatelessWidget {
}

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

final String title;

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

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

// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initConnectivity() async {
ConnectivityResult result;
late ConnectivityResult result;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
result = await _connectivity.checkConnectivity();
Expand Down Expand Up @@ -103,7 +103,7 @@ class _MyHomePageState extends State<MyHomePage> {
Future<void> _updateConnectionStatus(ConnectivityResult result) async {
switch (result) {
case ConnectivityResult.wifi:
String wifiName, wifiBSSID, wifiIP;
String? wifiName, wifiBSSID, wifiIP;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these actually ?? They look late.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the getter methods returning these infos returns nullables:
For example in wifiBSSID = await _wifiInfo.getWifiBSSID(), _wifiInfo.getWifiBSSID() returns Future<String?>


try {
if (!kIsWeb && Platform.isIOS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ description: Demonstrates how to use the wifi_info_flutter plugin.
publish_to: 'none'

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: ">=2.12.0-259.9.beta <3.0.0"

dependencies:
connectivity: 0.4.9+3
connectivity: ^3.0.0
flutter:
sdk: flutter
wifi_info_flutter:
Expand All @@ -16,7 +16,6 @@ dependencies:
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
cupertino_icons: ^1.0.0

dev_dependencies:
integration_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9
import 'dart:io';
import 'package:integration_test/integration_test.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9
import 'dart:convert';
import 'dart:io';
import 'package:flutter_driver/flutter_driver.dart';
Expand Down
6 changes: 3 additions & 3 deletions packages/wifi_info_flutter/wifi_info_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: wifi_info_flutter
description: A new flutter plugin project.
version: 2.0.0-nullsafety
homepage: https://github.com/flutter/plugins/tree/master/packages/wifi_info_flutter/wifi_info_flutter
version: 2.0.0

environment:
sdk: ">=2.12.0-0 <3.0.0"
sdk: ">=2.12.0-259.9.beta <3.0.0"
flutter: ">=1.20.0"

dependencies:
flutter:
sdk: flutter
wifi_info_flutter_platform_interface: ^2.0.0-nullsafety
wifi_info_flutter_platform_interface: ^2.0.0

dev_dependencies:
integration_test:
Expand Down