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
+11 -9
View File
@@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:get/get_utils/src/get_utils/get_utils.dart';
import 'package:http/http.dart' as http;
import '../../default_response_api.dart';
@@ -26,9 +27,10 @@ class NotificacoesApi{
Map<String, String> heads = Map();
heads["Content-type"] = "application/json; charset=utf-8";
var response = await http.get(url, headers: heads);
var response = await http.get(Uri.parse(url), headers: heads);
if (response != null) {
//if (response != null) {
if (!GetUtils.isNullOrBlank(response.body)!) {
if (response.statusCode == 200) {
var data = jsonDecode(response.body);
retorno = NotificacoesResponse.fromJson(data);
@@ -47,7 +49,7 @@ class NotificacoesApi{
return retorno;
}
Future<NotificacaoResponse> getNotificacao(int id) async{
Future<NotificacaoResponse> getNotificacao(int? id) async{
var retorno = new NotificacaoResponse(
errorCode: 0,
errorMessage: ""
@@ -63,9 +65,9 @@ class NotificacoesApi{
Map<String, String> heads = Map();
heads["Content-type"] = "application/json; charset=utf-8";
var response = await http.get(url, headers: heads);
var response = await http.get(Uri.parse(url), headers: heads);
if (response != null) {
if (!GetUtils.isNullOrBlank(response.body)!) {
if (response.statusCode == 200) {
var data = jsonDecode(response.body);
retorno = NotificacaoResponse.fromJson(data);
@@ -100,9 +102,9 @@ class NotificacoesApi{
var body = json.encode(post);
var response = await http.post(url, headers: heads, body: body);
var response = await http.post(Uri.parse(url), headers: heads, body: body);
if (response != null) {
if (!GetUtils.isNullOrBlank(response.body)!) {
if (response.statusCode == 200) {
var data = jsonDecode(response.body);
objRetorno = DefaultResponseApi.fromJson(data);
@@ -135,10 +137,10 @@ class NotificacoesApi{
var body = json.encode(post);
var response = await http.post(url, headers: heads, body: body);
var response = await http.post(Uri.parse(url), headers: heads, body: body);
if (response != null) {
if (!GetUtils.isNullOrBlank(response.body)!) {
if (response.statusCode == 200) {
var data = jsonDecode(response.body);
objRetorno = DefaultResponseApi.fromJson(data);