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());
|
||||
}
|
||||
|
||||
@@ -209,13 +209,6 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_dotenv:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_dotenv
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.2"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
||||
@@ -46,7 +46,6 @@ dependencies:
|
||||
get_it: ^7.2.0
|
||||
retrofit: ^3.0.1+1
|
||||
logger: ^1.1.0
|
||||
flutter_dotenv: ^5.0.2
|
||||
mockito: ^5.3.2
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:easy_cc_flutter/data/prefs/CurrencyPair.dart';
|
||||
import 'package:easy_cc_flutter/data/prefs/PreferenceProvider.dart';
|
||||
import 'package:easy_cc_flutter/data/repository/RepositoryImpl.dart';
|
||||
import 'package:easy_cc_flutter/locator.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
@@ -37,9 +36,8 @@ void main() {
|
||||
const String fromCurrency = "AUD - Australian Dollar";
|
||||
const String toCurrency = "GBP - British Pound Sterling";
|
||||
|
||||
setUpAll(() async {
|
||||
// Setup
|
||||
await dotenv.load(fileName: "test/resources/test_res.env");
|
||||
setUpAll(() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
// Create mock object.
|
||||
preferenceProvider = MockPreferenceProvider();
|
||||
currencyApi = MockCurrencyApi();
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:easy_cc_flutter/data/model/Currency.dart';
|
||||
import 'package:easy_cc_flutter/data/prefs/CurrencyPair.dart';
|
||||
import 'package:easy_cc_flutter/data/repository/RepositoryImpl.dart';
|
||||
import 'package:easy_cc_flutter/locator.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
@@ -24,9 +23,9 @@ void main() {
|
||||
const String fromCurrency = "AUD - Australian Dollar";
|
||||
const String toCurrency = "GBP - British Pound Sterling";
|
||||
|
||||
setUpAll(() async {
|
||||
// Setup
|
||||
await dotenv.load(fileName: "test/resources/test_res.env");
|
||||
setUpAll(() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// Create mock object.
|
||||
repository = MockRepositoryImpl();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user