Set correct type for metadata variable

This commit is contained in:
Roland Geider
2021-04-30 11:28:18 +02:00
parent ce0231fd2d
commit 6fa492c569

View File

@@ -84,7 +84,7 @@ class Auth with ChangeNotifier {
required String serverUrl,
}) async {
final uri = Uri.parse(serverUrl + '/api/v2/register/');
Map<String, String> metadata = Map();
Map<String, String>? metadata = Map();
// Read the api key from the manifest file
try {
@@ -103,7 +103,7 @@ class Auth with ChangeNotifier {
uri,
headers: {
HttpHeaders.contentTypeHeader: 'application/json; charset=UTF-8',
HttpHeaders.authorizationHeader: "Token ${metadata['wger.api_key']}"
HttpHeaders.authorizationHeader: "Token ${metadata!['wger.api_key']}"
},
body: json.encode(data),
);