ApiLayer constructor
ApiLayer({})
Implementation
ApiLayer({required Map<String, dynamic> env, Map<String, String>? customHeader, String? bearerToken, BuildContext? context, bool skipLoading = false}) {
Map<String, String> localHeader = customHeader ?? {};
localHeader["Content-Type"] = "application/json";
if(bearerToken != null) { localHeader['Authorization'] = 'Bearer $bearerToken'; }
if(env["API_TOKEN"] != null) { localHeader["Api-Token"] = env["API_TOKEN"]!; }
if(env["ENVIRONMENT"] != null) { environment = env["ENVIRONMENT"]!; }
if(context != null) {
this.context = context;
if(!skipLoading) {
loading = Loading(text: 'Carregando...', context: context,);
loading!.showOverlay();
}
}
if((env['skipFingerPrint'] ?? false)) { skipFingerPrintValidation = true; }
urlBase = "${env['HTTP_BASE']!}${env['URL_BASE']!}";
header = localHeader;
}