mirror of
https://github.com/hmalik144/easy_cc_flutter.git
synced 2025-12-10 03:05:34 +00:00
removed dotenv and replaced with environment variables
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_cc_flutter/data/network/app_dio.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
|
||||
@@ -11,10 +10,11 @@ part 'currencyApi.g.dart';
|
||||
@RestApi(baseUrl: "https://free.currencyconverterapi.com/api/v3/")
|
||||
abstract class CurrencyApi {
|
||||
factory CurrencyApi(Dio dio) = _CurrencyApi;
|
||||
static const api = String.fromEnvironment('currencyApiKey');
|
||||
|
||||
static CurrencyApi create() {
|
||||
final dio = AppDio.createDio();
|
||||
dio.options.queryParameters.addAll({"apiKey": dotenv.env['apiKey']!});
|
||||
dio.options.queryParameters.addAll({"apiKey": api});
|
||||
|
||||
return _CurrencyApi(dio);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
import 'Home.dart';
|
||||
@@ -13,7 +12,6 @@ var logger = Logger(
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
setupLocator();
|
||||
await dotenv.load();
|
||||
await locator<PreferenceProvider>().init();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user