migração flutter 2.2.1

This commit is contained in:
Renan
2021-06-01 16:52:01 -03:00
parent c44fcdddea
commit dd6bbb650b
25 changed files with 568 additions and 469 deletions
+6 -5
View File
@@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import 'package:device_info/device_info.dart';
import 'dart:io';
@@ -45,7 +46,7 @@ class FuncoesGerais{
return Future<String>.value(tokenPadrao);
}
static Future<void> registraDevice(String token) async{
static Future<void> registraDevice(String? token) async{
if(await FuncoesGerais.checkInternetConnection()){
if(token != null && token.isNotEmpty){
@@ -78,7 +79,7 @@ class FuncoesGerais{
try {
var body = json.encode(objPost);
//var response = await http.post(url, body: body,headers: heads);
await http.post(url, body: body,headers: heads);
await http.post(Uri.parse(url), body: body,headers: heads);
//var r = await http.post(url, body: body,headers: heads);
//print(r);
// if (response != null) {
@@ -112,8 +113,8 @@ class FuncoesGerais{
heads["Content-type"] = "application/json; charset=utf-8";
try {
var response = await http.get(url,headers: heads);
if (response != null) {
http.Response response = await http.get(Uri.parse(url),headers: heads);
if (!GetUtils.isNullOrBlank(response.body)!) {
if (response.statusCode == 200) {
var data = jsonDecode(response.body);
objRetorno = VersaoMinimaResponse.fromJson(data);
@@ -121,7 +122,7 @@ class FuncoesGerais{
// var v = packageInfo.version.split('.');
// int versaoAtual = 0;
//if(v.length > 0)versaoAtual = v[0] != null && v[0].isNotEmpty ? int.parse(v[0]) : 0;
if(FuncoesGerais.versaoAtual != null && objRetorno.versaoMinima > FuncoesGerais.versaoAtual){
if(objRetorno.versaoMinima! > FuncoesGerais.versaoAtual){
objRetorno.vOk = false;
}
}