check null safety

This commit is contained in:
tzw
2021-09-10 14:27:38 +06:30
parent a144c945b6
commit 7670779b03
57 changed files with 620 additions and 626 deletions

View File

@@ -56,8 +56,8 @@ class PackageDataProvider {
token: await getToken());
}
Future<List<Package>> ftsSearchPackage(String term) async {
if (term == null || term == '') return List();
Future<List<Package>?> ftsSearchPackage(String term) async {
if (term == null || term == '') return [];
var bytes = utf8.encode(term);
var base64Str = base64.encode(bytes);
@@ -72,7 +72,7 @@ class PackageDataProvider {
"/api/fts/$packages_collection/$escapePackage/$limit", "GET",
url: Config.instance.reportURL, token: await getToken());
if (data == null) return List();
if (data == null) return [];
data.forEach((p) {
var package = Package.fromJson(p);
@@ -86,7 +86,7 @@ class PackageDataProvider {
}
Future<List<Package>> searchPackage(String term) async {
if (term == null || term == '') return List();
if (term == null || term == '') return [];
List<Package> packages = [];