Skip to content

Commit 35873c5

Browse files
committed
upgraded to null safety
1 parent 37314e4 commit 35873c5

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

lib/android_signing.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
part of flutter_automation;
22

3-
String alias;
3+
String? alias;
44
String keystorePath = "keys/keystore.jks";
5-
String keyPass;
6-
String keystorePass;
5+
String? keyPass;
6+
String? keystorePass;
77
const String keyPropertiesPath = "./android/key.properties";
88

99
/// Main function that uses other helper functions to setup android signing
@@ -23,16 +23,16 @@ void _generateKeystore() {
2323

2424
stdout.write(
2525
"enter dname as (CN=popupbits.com, OU=DD, O=Popup Bits Ltd., L=Kathmandu, S=Bagmati, C=NP): ");
26-
String dname = stdin.readLineSync();
27-
if (dname.isEmpty) dname = defDname;
26+
String? dname = stdin.readLineSync();
27+
if (dname == null || dname.isEmpty) dname = defDname;
2828
stdout.write("key password: ");
2929
keyPass = stdin.readLineSync();
3030
stdout.write("keystore password: ");
3131
keystorePass = stdin.readLineSync();
32-
if (alias.isEmpty ||
32+
if (alias == null || alias!.isEmpty ||
3333
dname.isEmpty ||
34-
keyPass.isEmpty ||
35-
keystorePass.isEmpty) {
34+
keyPass == null || keyPass!.isEmpty ||
35+
keystorePass == null || keystorePass!.isEmpty) {
3636
stderr.writeln("All inputs that don't have default mentioned are required");
3737
return;
3838
}
@@ -46,15 +46,15 @@ void _generateKeystore() {
4646
"-genkey",
4747
"-noprompt",
4848
"-alias",
49-
alias,
49+
alias!,
5050
"-dname",
5151
dname,
5252
"-keystore",
5353
keystorePath,
5454
"-storepass",
55-
keystorePass,
55+
keystorePass!,
5656
"-keypass",
57-
keyPass,
57+
keyPass!,
5858
"-keyalg",
5959
"RSA",
6060
"-keysize",

lib/flutter_automation.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ void decipherScript(List<String> arguments) async {
4040

4141
var argResults = parser.parse(arguments);
4242
if (argResults.command?.name == "gen") {
43-
final genArgResults = genParser.parse(argResults.command.arguments);
43+
final genArgResults = genParser.parse(argResults.command!.arguments);
4444
if (genArgResults["core"]) {
4545
_genCore(path: genArgResults["path"]);
4646
} else {
4747
_genFeatureDirectory(
4848
path: genArgResults["path"],
49-
feature: argResults.command.arguments.first);
49+
feature: argResults.command!.arguments.first);
5050
}
5151
return;
5252
}

lib/gen/helper.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
part of flutter_automation;
22

3-
void _genFeatureDirectory({String path, String feature}) {
3+
void _genFeatureDirectory({String path = '', String? feature}) {
44
_genBaseDirs("$path/features/$feature");
55
}
66

@@ -17,7 +17,7 @@ void _genBaseDirs(String path) {
1717
stdout.writeln("resource directory created");
1818
}
1919

20-
void _genCore({String path}) {
20+
void _genCore({String path = ''}) {
2121
final core = "$path/core";
2222
_genBaseDirs(core);
2323
final dbConstants = File("$core/res/db_constants.dart");

lib/google_maps.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Future<void> googleMaps() async {
1111
/// adds google maps dependency to pubspec.yaml file
1212
Future<void> addGoogleMap() async {
1313
if (_Commons.pluginExists("google_maps_flutter")) return;
14-
String plugin = await _PubspecAPI().getPackage('google_maps_flutter');
14+
String? plugin = await _PubspecAPI().getPackage('google_maps_flutter');
1515
if (plugin == null)
1616
plugin =
1717
"google_maps_flutter: ${_Commons.loadConfig()['plugins']['google_maps']}";

lib/pubspec_api.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ part of flutter_automation;
33
class _PubspecAPI {
44
final String baseUrl = "https://pub.dev/api/packages/";
55
_PubspecAPI();
6-
Future<String> getPackage(String package) async {
7-
http.Response res = await http.get(baseUrl + package);
6+
Future<String?> getPackage(String package) async {
7+
http.Response res = await http.get(baseUrl + package as Uri);
88
if (res.statusCode == 200) {
99
Map<String, dynamic> resJson = json.decode(res.body);
1010
_PubPackage package = _PubPackage.fromMap(resJson);
@@ -16,7 +16,7 @@ class _PubspecAPI {
1616
}
1717

1818
class _PubPackage {
19-
final String name;
19+
final String? name;
2020
final _Version latest;
2121

2222
_PubPackage(this.name, this.latest);
@@ -27,8 +27,8 @@ class _PubPackage {
2727
}
2828

2929
class _Version {
30-
final String version;
31-
final String archiveUrl;
30+
final String? version;
31+
final String? archiveUrl;
3232

3333
_Version(this.version, this.archiveUrl);
3434

pubspec.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: args
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "1.6.0"
10+
version: "2.1.1"
1111
async:
1212
dependency: transitive
1313
description:
@@ -73,14 +73,14 @@ packages:
7373
name: http
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "0.12.2"
76+
version: "0.13.3"
7777
http_parser:
7878
dependency: transitive
7979
description:
8080
name: http_parser
8181
url: "https://pub.dartlang.org"
8282
source: hosted
83-
version: "3.1.3"
83+
version: "4.0.0"
8484
matcher:
8585
dependency: transitive
8686
description:
@@ -108,7 +108,7 @@ packages:
108108
name: pedantic
109109
url: "https://pub.dartlang.org"
110110
source: hosted
111-
version: "1.8.0+1"
111+
version: "1.11.1"
112112
sky_engine:
113113
dependency: transitive
114114
description: flutter
@@ -176,6 +176,6 @@ packages:
176176
name: yaml
177177
url: "https://pub.dartlang.org"
178178
source: hosted
179-
version: "2.2.1"
179+
version: "3.1.0"
180180
sdks:
181181
dart: ">=2.12.0 <3.0.0"

pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ author: Damodar Lohani<dlohani48@gmail.com>
66
homepage: https://github.com/lohanidamodar/flutter_automation
77

88
environment:
9-
sdk: ">=2.1.0 <3.0.0"
9+
sdk: '>=2.12.0 <3.0.0'
1010

1111
dependencies:
1212
flutter:
1313
sdk: flutter
14-
args: ^1.6.0
15-
yaml: ^2.2.1
16-
http: ^0.12.2
14+
args: ^2.1.1
15+
yaml: ^3.1.0
16+
http: ^0.13.3
1717

1818
dev_dependencies:
1919
flutter_test:

0 commit comments

Comments
 (0)