forked from firka/student-legacy
connectivity testing
This commit is contained in:
parent
b6a8696911
commit
d1e6cc1fbb
@ -7,6 +7,7 @@ import 'package:filcnaplo/models/settings.dart';
|
|||||||
import 'package:filcnaplo/models/supporter.dart';
|
import 'package:filcnaplo/models/supporter.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/school.dart';
|
import 'package:filcnaplo_kreta_api/models/school.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
|
||||||
class FilcAPI {
|
class FilcAPI {
|
||||||
// Public API
|
// Public API
|
||||||
@ -22,6 +23,8 @@ class FilcAPI {
|
|||||||
static const REPO = "filc/naplo";
|
static const REPO = "filc/naplo";
|
||||||
static const RELEASES = "https://api.github.com/repos/$REPO/releases";
|
static const RELEASES = "https://api.github.com/repos/$REPO/releases";
|
||||||
|
|
||||||
|
static Future<bool> checkConnectivity() async => (await Connectivity().checkConnectivity()) != ConnectivityResult.none;
|
||||||
|
|
||||||
static Future<List<School>?> getSchools() async {
|
static Future<List<School>?> getSchools() async {
|
||||||
try {
|
try {
|
||||||
http.Response res = await http.get(Uri.parse(SCHOOL_LIST));
|
http.Response res = await http.get(Uri.parse(SCHOOL_LIST));
|
||||||
|
@ -35,6 +35,7 @@ dependencies:
|
|||||||
permission_handler: ^8.1.4+2
|
permission_handler: ^8.1.4+2
|
||||||
share_plus: ^2.1.4
|
share_plus: ^2.1.4
|
||||||
package_info_plus: ^1.0.6
|
package_info_plus: ^1.0.6
|
||||||
|
connectivity_plus: ^1.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user