Created .env file for environment variables and added corresponding package (flutter_dotenv)

This commit is contained in:
2024-01-15 16:08:16 +03:00
parent d530b6b409
commit b3a49c85a2
7 changed files with 14 additions and 11 deletions

View File

@@ -1,5 +1,3 @@
import 'dart:ffi';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
@@ -7,6 +5,7 @@ import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_prof
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:hive/hive.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
part 'my_profile_event.dart';
part 'my_profile_state.dart';
@@ -24,7 +23,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
box.delete('token');
final response = await http.post(
Uri.parse('http://10.55.5.126:1092/api/profile/logout'),
Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/logout'),
headers: {
'Authorization': 'Bearer $token',
},
@@ -47,7 +46,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
final box = await Hive.openBox('token');
final token = box.get('token');
final response = await http.get(
Uri.parse('https://emaibo4wahye-dev3.eatvio.ru/api/profile/index'),
Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/index'),
headers: {
'Authorization': 'Bearer $token',
},