fix: handle error for incorrect url in scanner_users.json

This commit is contained in:
henne 2024-02-12 14:48:50 +01:00
parent 9271bfbb16
commit b861ea9292
4 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,4 @@
#!/bin/bash
flutter build appbundle --release
flutter build apk --release

View File

@ -43,6 +43,9 @@ Future<List<LoginUser>> getLoginUsers() async {
if (service.get<bool>('use_custom_user_url')!) {
url = service.get<String>('custom_user_url')!;
}
if (url == "") {
return List<LoginUser>.empty();
}
final response = await http.get(Uri.parse(url), headers: {
HttpHeaders.contentTypeHeader: 'application/json; charset=UTF-8',
HttpHeaders.acceptHeader: 'application/json',

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:provider/provider.dart';
@ -120,6 +119,12 @@ class LoginWidgetState extends ScanAwareState<LoginWidget> {
_errorText = "$message ${err.body}";
});
return;
} on ArgumentError catch (err) {
var message = "Ein Fehler ist aufgetreten: $err";
setState(() {
_errorText = message;
});
return;
} catch (err) {
setState(() {
_errorText = err.toString();

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.4.4+21
version: 1.4.5+22
environment:
sdk: ">=3.0.0"