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);
+24 -24
View File
@@ -1,6 +1,6 @@
class NotificacaoLikeRequest {
int iD;
String like;
int? iD;
String? like;
NotificacaoLikeRequest({this.iD, this.like});
@@ -18,8 +18,8 @@ class NotificacaoLikeRequest {
}
class NotificacaoLidaRequest {
String latitude;
String longitude;
String? latitude;
String? longitude;
NotificacaoLidaRequest({this.latitude, this.longitude});
@@ -38,9 +38,9 @@ class NotificacaoLidaRequest {
class NotificacaoResponse {
NotificacaoResults result;
int errorCode;
String errorMessage;
NotificacaoResults? result;
int? errorCode;
String? errorMessage;
NotificacaoResponse({this.result, this.errorCode, this.errorMessage});
@@ -54,7 +54,7 @@ class NotificacaoResponse {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.result != null) {
data['Result'] = this.result.toJson();
data['Result'] = this.result!.toJson();
}
data['ErrorCode'] = this.errorCode;
data['ErrorMessage'] = this.errorMessage;
@@ -63,18 +63,18 @@ class NotificacaoResponse {
}
class NotificacoesResponse {
List<NotificacaoResults> results;
int errorCode;
String errorMessage;
bool loadMore;
List<NotificacaoResults>? results;
int? errorCode;
String? errorMessage;
bool? loadMore;
NotificacoesResponse({this.results, this.errorCode, this.errorMessage,this.loadMore});
NotificacoesResponse.fromJson(Map<String, dynamic> json) {
if (json['Results'] != null) {
results = new List<NotificacaoResults>();
results = <NotificacaoResults>[];
json['Results'].forEach((v) {
results.add(new NotificacaoResults.fromJson(v));
results!.add(new NotificacaoResults.fromJson(v));
});
}
errorCode = json['ErrorCode'];
@@ -84,7 +84,7 @@ class NotificacoesResponse {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.results != null) {
data['Results'] = this.results.map((v) => v.toJson()).toList();
data['Results'] = this.results!.map((v) => v.toJson()).toList();
}
data['ErrorCode'] = this.errorCode;
data['ErrorMessage'] = this.errorMessage;
@@ -93,15 +93,15 @@ class NotificacoesResponse {
}
class NotificacaoResults {
int iD;
String titulo;
String texto;
String conteudo;
String dataNotificacao;
String tipoConteudo;
bool visualizado;
String imageUrl;
String like;
int? iD;
String? titulo;
String? texto;
String? conteudo;
String? dataNotificacao;
String? tipoConteudo;
bool? visualizado;
String? imageUrl;
String? like;
NotificacaoResults(
{this.iD,