Files
cssd/lib/providers/test_result_old.dart
T
2021-06-21 14:14:54 +04:30

39 lines
766 B
Dart

import '../config/urls.dart';
import '../config/user.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
class TestResult with ChangeNotifier{
final int id;
final String name;
final String date;
final String deviceId;
String result;
bool get isVerified {
return result == 'Verified';
}
TestResult({
this.id,
this.name,
this.date,
this.deviceId,
this.result,
});
Future<void> toggleVerify() async {
final response = await http.post(
Uri.parse(Url.verifyTest(id)), headers: {
'Authorization': User.token
}
);
if (response.statusCode == 200) {
result = result == 'Verified' ? 'NotVerified' : 'Verified';
notifyListeners();
}
}
}