APIs: Make the tests pass with null safety

This commit is contained in:
Vishesh Handa
2021-05-27 13:56:56 +02:00
parent 190dae6f09
commit 8b67abbc83
4 changed files with 11 additions and 13 deletions

View File

@ -108,3 +108,12 @@ class GitHostException implements Exception {
return "GitHostException: " + cause;
}
}
String toCurlCommand(Uri url, Map<String, String> headers) {
var headersStr = "";
headers.forEach((key, value) {
headersStr += ' -H "$key: $value" ';
});
return "curl -X GET '$url' $headersStr";
}

View File

@ -9,7 +9,6 @@ import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:gitjournal/utils.dart';
import 'package:gitjournal/utils/logger.dart';
import 'githost.dart';
@ -255,7 +254,7 @@ class GitHub implements GitHost {
issues: parsedJson['open_issues_count'],
language: parsedJson['language'],
private: parsedJson['private'],
tags: parsedJson['topics'],
tags: parsedJson['topics'] ?? [],
license: licenseMap != null ? licenseMap['spdx_id'] : null,
);
}

View File

@ -10,7 +10,6 @@ import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:gitjournal/utils.dart';
import 'package:gitjournal/utils/logger.dart';
import 'githost.dart';
@ -233,7 +232,7 @@ class GitLab implements GitHost {
fullName: fullName,
cloneUrl: parsedJson['ssh_url_to_repo'],
updatedAt: updatedAt,
description: parsedJson['description'],
description: parsedJson['description'] ?? "",
stars: parsedJson['star_count'],
forks: parsedJson['forks_count'],
issues: parsedJson['open_issues_count'],

View File

@ -79,15 +79,6 @@ bool folderWithSpecExists(BuildContext context, String spec) {
return rootFolder.getFolderWithSpec(spec) != null;
}
String toCurlCommand(Uri url, Map<String, String> headers) {
var headersStr = "";
headers.forEach((key, value) {
headersStr += ' -H "$key: $value" ';
});
return "curl -X GET '$url' $headersStr";
}
Future<void> shareNote(Note note) async {
return Share.share(note.serialize());
}