From 15c573d181549a933edddcbe71de7e561bef2b4d Mon Sep 17 00:00:00 2001 From: Sixtus Agbo Date: Tue, 26 Mar 2024 04:06:42 +0100 Subject: [PATCH 1/7] Update http client usage in request http service --- lib/providers/collection_providers.dart | 20 +++++++++++++------- lib/services/http_service.dart | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/lib/providers/collection_providers.dart b/lib/providers/collection_providers.dart index 75e9d7c5..10545f3a 100644 --- a/lib/providers/collection_providers.dart +++ b/lib/providers/collection_providers.dart @@ -1,11 +1,12 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'settings_providers.dart'; -import 'ui_providers.dart'; +import 'package:http/http.dart' as http; + +import '../consts.dart'; import '../models/models.dart'; import '../services/services.dart' show hiveHandler, HiveHandler, request; import '../utils/utils.dart' show getNewUuid, collectionToHAR; -import '../consts.dart'; -import 'package:http/http.dart' as http; +import 'settings_providers.dart'; +import 'ui_providers.dart'; final selectedIdStateProvider = StateProvider((ref) => null); @@ -24,13 +25,16 @@ final requestSequenceProvider = StateProvider>((ref) { return ids ?? []; }); +final client = http.Client(); + final StateNotifierProvider?> - collectionStateNotifierProvider = - StateNotifierProvider((ref) => CollectionStateNotifier(ref, hiveHandler)); + collectionStateNotifierProvider = StateNotifierProvider( + (ref) => CollectionStateNotifier(ref, hiveHandler, client)); class CollectionStateNotifier extends StateNotifier?> { - CollectionStateNotifier(this.ref, this.hiveHandler) : super(null) { + CollectionStateNotifier(this.ref, this.hiveHandler, this.httpClient) + : super(null) { var status = loadData(); Future.microtask(() { if (status) { @@ -46,6 +50,7 @@ class CollectionStateNotifier final Ref ref; final HiveHandler hiveHandler; final baseResponseModel = const ResponseModel(); + final http.Client httpClient; bool hasId(String id) => state?.keys.contains(id) ?? false; @@ -187,6 +192,7 @@ class CollectionStateNotifier (http.Response?, Duration?, String?)? responseRec = await request( requestModel, defaultUriScheme: defaultUriScheme, + client: httpClient, ); late final RequestModel newRequestModel; if (responseRec.$1 == null) { diff --git a/lib/services/http_service.dart b/lib/services/http_service.dart index dec0b516..9eb9228e 100644 --- a/lib/services/http_service.dart +++ b/lib/services/http_service.dart @@ -1,14 +1,16 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'package:http/http.dart' as http; -import 'package:apidash/utils/utils.dart'; -import 'package:apidash/models/models.dart'; + import 'package:apidash/consts.dart'; +import 'package:apidash/models/models.dart'; +import 'package:apidash/utils/utils.dart'; +import 'package:http/http.dart' as http; Future<(http.Response?, Duration?, String?)> request( RequestModel requestModel, { String defaultUriScheme = kDefaultUriScheme, + required http.Client client, }) async { (Uri?, String?) uriRec = getValidRequestUri( requestModel.url, @@ -66,23 +68,25 @@ Future<(http.Response?, Duration?, String?)> request( } switch (requestModel.method) { case HTTPVerb.get: - response = await http.get(requestUrl, headers: headers); + response = await client.get(requestUrl, headers: headers); break; case HTTPVerb.head: - response = await http.head(requestUrl, headers: headers); + response = await client.head(requestUrl, headers: headers); break; case HTTPVerb.post: - response = await http.post(requestUrl, headers: headers, body: body); + response = + await client.post(requestUrl, headers: headers, body: body); break; case HTTPVerb.put: - response = await http.put(requestUrl, headers: headers, body: body); + response = await client.put(requestUrl, headers: headers, body: body); break; case HTTPVerb.patch: - response = await http.patch(requestUrl, headers: headers, body: body); + response = + await client.patch(requestUrl, headers: headers, body: body); break; case HTTPVerb.delete: response = - await http.delete(requestUrl, headers: headers, body: body); + await client.delete(requestUrl, headers: headers, body: body); break; } stopwatch.stop(); From 3fa3076790cd1c3c1b3cd8607097b9ff990ac269 Mon Sep 17 00:00:00 2001 From: Sixtus Agbo Date: Tue, 26 Mar 2024 04:08:13 +0100 Subject: [PATCH 2/7] Add some tests for codePaneVisibleStateProvider I added some tests for the value of this provider by state injection. Still working on tests for interaction, value persistence across rebuilds and proper disposal of this provider. --- test/providers/ui_providers_test.dart | 150 ++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) diff --git a/test/providers/ui_providers_test.dart b/test/providers/ui_providers_test.dart index 9d34619d..a68fbfec 100644 --- a/test/providers/ui_providers_test.dart +++ b/test/providers/ui_providers_test.dart @@ -3,14 +3,23 @@ import 'dart:io'; import 'package:apidash/providers/providers.dart'; import 'package:apidash/screens/dashboard.dart'; import 'package:apidash/screens/home_page/collection_pane.dart'; +import 'package:apidash/screens/home_page/editor_pane/details_card/code_pane.dart'; +import 'package:apidash/screens/home_page/editor_pane/details_card/response_pane.dart'; +import 'package:apidash/screens/home_page/editor_pane/editor_default.dart'; +import 'package:apidash/screens/home_page/editor_pane/editor_pane.dart'; +import 'package:apidash/screens/home_page/editor_pane/url_card.dart'; import 'package:apidash/screens/home_page/home_page.dart'; import 'package:apidash/screens/intro_page.dart'; import 'package:apidash/screens/settings_page.dart'; import 'package:apidash/services/hive_services.dart'; +import 'package:apidash/widgets/response_widgets.dart'; +import 'package:apidash/widgets/textfields.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart' as http; +import 'package:http/testing.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -336,4 +345,145 @@ void main() { expect(isDisposed, true); }); }); + + group('Testing codePaneVisibleStateProvider', () { + testWidgets("It should have have an initial value of false", + (tester) async { + // Mock the http client to return a 200 response + final mockClient = MockClient((request) async { + return http.Response('{"countries": "codes"}', 200); + }); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + collectionStateNotifierProvider.overrideWith( + (ref) => CollectionStateNotifier(ref, hiveHandler, mockClient), + ) + ], + child: const MaterialApp( + home: RequestEditorPane(), + ), + ), + ); + + // Verify that the initial value is false + final editorPane = tester.element(find.byType(RequestEditorPane)); + final container = ProviderScope.containerOf(editorPane); + expect(container.read(codePaneVisibleStateProvider), false); + }); + + testWidgets("When state is false ResponsePane should be visible", + (tester) async { + // Mock the http client to return a 200 response + final mockClient = MockClient((request) async { + return http.Response('{"countries": "codes"}', 200); + }); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + collectionStateNotifierProvider.overrideWith( + (ref) => CollectionStateNotifier(ref, hiveHandler, mockClient), + ) + ], + child: const MaterialApp( + home: RequestEditorPane(), + ), + ), + ); + + expect(find.byType(RequestEditorDefault), findsOneWidget); + + // Tap on the "Plus New" button + Finder plusNewButton = find.descendant( + of: find.byType(RequestEditorDefault), + matching: find.byType(ElevatedButton), + ); + await tester.tap(plusNewButton); + await tester.pump(); + + // Verify that NotSentWidget is visible + expect(find.byType(NotSentWidget), findsOneWidget); + + // Add some data in URLTextField + Finder field = find.descendant( + of: find.byType(URLField), + matching: find.byType(TextFormField), + ); + const url = 'https://api.foss42.com/country/codes'; + await tester.enterText(field, url); + await tester.pump(); + + // Tap on the "Send" button + Finder sendButton = find.byType(SendButton); + await tester.tap(sendButton); + await tester.pump(); + + final editorPane = tester.element(find.byType(RequestEditorPane)); + final container = ProviderScope.containerOf(editorPane); + expect(container.read(codePaneVisibleStateProvider), false); + expect(find.byType(ResponsePane), findsOneWidget); + }); + + testWidgets("When state is true CodePane should be visible", + (tester) async { + // Mock the http client to return a 200 response + final mockClient = MockClient((request) async { + return http.Response('{"countries": "codes"}', 200); + }); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + collectionStateNotifierProvider.overrideWith( + (ref) => CollectionStateNotifier(ref, hiveHandler, mockClient), + ) + ], + child: const MaterialApp( + home: Scaffold( + body: RequestEditorPane(), + ), + ), + ), + ); + + expect(find.byType(RequestEditorDefault), findsOneWidget); + + // Tap on the "Plus New" button + Finder plusNewButton = find.descendant( + of: find.byType(RequestEditorDefault), + matching: find.byType(ElevatedButton), + ); + await tester.tap(plusNewButton); + await tester.pump(); + + // Verify that NotSentWidget is visible + expect(find.byType(NotSentWidget), findsOneWidget); + + // Add some data in URLTextField + Finder field = find.descendant( + of: find.byType(URLField), + matching: find.byType(TextFormField), + ); + const url = 'https://api.foss42.com/country/codes'; + await tester.enterText(field, url); + await tester.pump(); + + // Tap on the "Send" button + Finder sendButton = find.byType(SendButton); + await tester.tap(sendButton); + await tester.pump(); + + final editorPane = tester.element(find.byType(RequestEditorPane)); + final container = ProviderScope.containerOf(editorPane); + // Change codePaneVisibleStateProvider state to true + container.read(codePaneVisibleStateProvider.notifier).state = true; + await tester.pump(); + + // Verify that the CodePane is visible + expect(container.read(codePaneVisibleStateProvider), true); + expect(find.byType(CodePane), findsOneWidget); + }); + }); } From 51911e4b0a452c529f471399f6d46f7ebb3a1398 Mon Sep 17 00:00:00 2001 From: Sixtus Agbo Date: Thu, 28 Mar 2024 02:22:51 +0100 Subject: [PATCH 3/7] Remove request mocks I am now sending actual requests as adviced by @ashitaprasad since the APIs are maintained by us --- lib/providers/collection_providers.dart | 11 ++----- lib/services/http_service.dart | 15 ++++----- test/providers/ui_providers_test.dart | 44 ++++--------------------- 3 files changed, 15 insertions(+), 55 deletions(-) diff --git a/lib/providers/collection_providers.dart b/lib/providers/collection_providers.dart index 10545f3a..e55ab8bd 100644 --- a/lib/providers/collection_providers.dart +++ b/lib/providers/collection_providers.dart @@ -25,16 +25,13 @@ final requestSequenceProvider = StateProvider>((ref) { return ids ?? []; }); -final client = http.Client(); - final StateNotifierProvider?> - collectionStateNotifierProvider = StateNotifierProvider( - (ref) => CollectionStateNotifier(ref, hiveHandler, client)); + collectionStateNotifierProvider = + StateNotifierProvider((ref) => CollectionStateNotifier(ref, hiveHandler)); class CollectionStateNotifier extends StateNotifier?> { - CollectionStateNotifier(this.ref, this.hiveHandler, this.httpClient) - : super(null) { + CollectionStateNotifier(this.ref, this.hiveHandler) : super(null) { var status = loadData(); Future.microtask(() { if (status) { @@ -50,7 +47,6 @@ class CollectionStateNotifier final Ref ref; final HiveHandler hiveHandler; final baseResponseModel = const ResponseModel(); - final http.Client httpClient; bool hasId(String id) => state?.keys.contains(id) ?? false; @@ -192,7 +188,6 @@ class CollectionStateNotifier (http.Response?, Duration?, String?)? responseRec = await request( requestModel, defaultUriScheme: defaultUriScheme, - client: httpClient, ); late final RequestModel newRequestModel; if (responseRec.$1 == null) { diff --git a/lib/services/http_service.dart b/lib/services/http_service.dart index 9eb9228e..35a45e36 100644 --- a/lib/services/http_service.dart +++ b/lib/services/http_service.dart @@ -10,7 +10,6 @@ import 'package:http/http.dart' as http; Future<(http.Response?, Duration?, String?)> request( RequestModel requestModel, { String defaultUriScheme = kDefaultUriScheme, - required http.Client client, }) async { (Uri?, String?) uriRec = getValidRequestUri( requestModel.url, @@ -68,25 +67,23 @@ Future<(http.Response?, Duration?, String?)> request( } switch (requestModel.method) { case HTTPVerb.get: - response = await client.get(requestUrl, headers: headers); + response = await http.get(requestUrl, headers: headers); break; case HTTPVerb.head: - response = await client.head(requestUrl, headers: headers); + response = await http.head(requestUrl, headers: headers); break; case HTTPVerb.post: - response = - await client.post(requestUrl, headers: headers, body: body); + response = await http.post(requestUrl, headers: headers, body: body); break; case HTTPVerb.put: - response = await client.put(requestUrl, headers: headers, body: body); + response = await http.put(requestUrl, headers: headers, body: body); break; case HTTPVerb.patch: - response = - await client.patch(requestUrl, headers: headers, body: body); + response = await http.patch(requestUrl, headers: headers, body: body); break; case HTTPVerb.delete: response = - await client.delete(requestUrl, headers: headers, body: body); + await http.delete(requestUrl, headers: headers, body: body); break; } stopwatch.stop(); diff --git a/test/providers/ui_providers_test.dart b/test/providers/ui_providers_test.dart index a68fbfec..c6c66c6d 100644 --- a/test/providers/ui_providers_test.dart +++ b/test/providers/ui_providers_test.dart @@ -18,8 +18,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:http/http.dart' as http; -import 'package:http/testing.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -349,19 +347,9 @@ void main() { group('Testing codePaneVisibleStateProvider', () { testWidgets("It should have have an initial value of false", (tester) async { - // Mock the http client to return a 200 response - final mockClient = MockClient((request) async { - return http.Response('{"countries": "codes"}', 200); - }); - await tester.pumpWidget( - ProviderScope( - overrides: [ - collectionStateNotifierProvider.overrideWith( - (ref) => CollectionStateNotifier(ref, hiveHandler, mockClient), - ) - ], - child: const MaterialApp( + const ProviderScope( + child: MaterialApp( home: RequestEditorPane(), ), ), @@ -375,19 +363,9 @@ void main() { testWidgets("When state is false ResponsePane should be visible", (tester) async { - // Mock the http client to return a 200 response - final mockClient = MockClient((request) async { - return http.Response('{"countries": "codes"}', 200); - }); - await tester.pumpWidget( - ProviderScope( - overrides: [ - collectionStateNotifierProvider.overrideWith( - (ref) => CollectionStateNotifier(ref, hiveHandler, mockClient), - ) - ], - child: const MaterialApp( + const ProviderScope( + child: MaterialApp( home: RequestEditorPane(), ), ), @@ -428,19 +406,9 @@ void main() { testWidgets("When state is true CodePane should be visible", (tester) async { - // Mock the http client to return a 200 response - final mockClient = MockClient((request) async { - return http.Response('{"countries": "codes"}', 200); - }); - await tester.pumpWidget( - ProviderScope( - overrides: [ - collectionStateNotifierProvider.overrideWith( - (ref) => CollectionStateNotifier(ref, hiveHandler, mockClient), - ) - ], - child: const MaterialApp( + const ProviderScope( + child: MaterialApp( home: Scaffold( body: RequestEditorPane(), ), From 2700ade751d323f237b583e76a53a5a691f24cd4 Mon Sep 17 00:00:00 2001 From: Sixtus Agbo Date: Thu, 28 Mar 2024 02:52:23 +0100 Subject: [PATCH 4/7] Add more tests for codePaneVisibleStateProvider --- test/providers/ui_providers_test.dart | 159 ++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) diff --git a/test/providers/ui_providers_test.dart b/test/providers/ui_providers_test.dart index c6c66c6d..1c4fde90 100644 --- a/test/providers/ui_providers_test.dart +++ b/test/providers/ui_providers_test.dart @@ -453,5 +453,164 @@ void main() { expect(container.read(codePaneVisibleStateProvider), true); expect(find.byType(CodePane), findsOneWidget); }); + + testWidgets("Hide/View Code button toggles the state", (tester) async { + await tester.pumpWidget( + const ProviderScope( + child: MaterialApp( + home: Scaffold( + body: RequestEditorPane(), + ), + ), + ), + ); + + expect(find.byType(RequestEditorDefault), findsOneWidget); + + // Tap on the "Plus New" button + Finder plusNewButton = find.descendant( + of: find.byType(RequestEditorDefault), + matching: find.byType(ElevatedButton), + ); + await tester.tap(plusNewButton); + await tester.pump(); + + // Verify that NotSentWidget is visible + expect(find.byType(NotSentWidget), findsOneWidget); + + // Add some data in URLTextField + Finder field = find.descendant( + of: find.byType(URLField), + matching: find.byType(TextFormField), + ); + const url = 'https://api.foss42.com/country/codes'; + await tester.enterText(field, url); + await tester.pump(); + + // Tap on the "Send" button + Finder sendButton = find.byType(SendButton); + await tester.tap(sendButton); + await tester.pump(); + + final editorPane = tester.element(find.byType(RequestEditorPane)); + final container = ProviderScope.containerOf(editorPane); + final bool currentValue = container.read(codePaneVisibleStateProvider); + + // Click on View Code button + await tester.tap(find.byIcon(Icons.code_rounded)); + await tester.pump(); + + // Verify that the state value has changed + expect(container.read(codePaneVisibleStateProvider), !currentValue); + final bool newValue = container.read(codePaneVisibleStateProvider); + + // Click on Hide Code button + await tester.tap(find.byIcon(Icons.code_off_rounded)); + await tester.pump(); + + // Verify that the state value has changed + expect(container.read(codePaneVisibleStateProvider), !newValue); + }); + + testWidgets("That state persists across widget rebuilds", (tester) async { + await tester.pumpWidget( + const ProviderScope( + child: MaterialApp( + home: Scaffold( + body: RequestEditorPane(), + ), + ), + ), + ); + + expect(find.byType(RequestEditorDefault), findsOneWidget); + + // Tap on the "Plus New" button + Finder plusNewButton = find.descendant( + of: find.byType(RequestEditorDefault), + matching: find.byType(ElevatedButton), + ); + await tester.tap(plusNewButton); + await tester.pump(); + + // Verify that NotSentWidget is visible + expect(find.byType(NotSentWidget), findsOneWidget); + + // Add some data in URLTextField + Finder field = find.descendant( + of: find.byType(URLField), + matching: find.byType(TextFormField), + ); + const url = 'https://api.foss42.com/country/codes'; + await tester.enterText(field, url); + await tester.pump(); + + // Tap on the "Send" button + Finder sendButton = find.byType(SendButton); + await tester.tap(sendButton); + await tester.pump(); + + final editorPane = tester.element(find.byType(RequestEditorPane)); + final container = ProviderScope.containerOf(editorPane); + final bool currentValue = container.read(codePaneVisibleStateProvider); + + // Click on View Code button + await tester.tap(find.byIcon(Icons.code_rounded)); + await tester.pump(); + + // Verify that the state value has changed + expect(container.read(codePaneVisibleStateProvider), !currentValue); + bool matcher = !currentValue; + + // Rebuild the widget tree + await tester.pumpWidget( + const ProviderScope( + child: MaterialApp( + home: Scaffold( + body: RequestEditorPane(), + ), + ), + ), + ); + + // Verify that the value of codePaneVisibleStateProvider is still true + final containerAfterRebuild = ProviderScope.containerOf(editorPane); + bool actual = containerAfterRebuild.read(codePaneVisibleStateProvider); + expect(actual, matcher); + }); + + testWidgets("That it is properly disposed", (tester) async { + await tester.pumpWidget( + const ProviderScope( + child: MaterialApp( + home: Scaffold( + body: RequestEditorPane(), + ), + ), + ), + ); + + // Verify that codePaneVisibleStateProvider is present + final editorPane = tester.element(find.byType(RequestEditorPane)); + final container = ProviderScope.containerOf(editorPane); + expect(container.read(codePaneVisibleStateProvider).runtimeType, bool); + + // Update the widget tree to dispose the provider + await tester.pumpWidget(const MaterialApp()); + + // Verify that the provider was disposed + expect(() => container.read(codePaneVisibleStateProvider), + throwsA(isA())); + expect( + () => container.read(codePaneVisibleStateProvider), + throwsA( + isA().having( + (e) => e.message, + 'message', + contains('was already disposed'), + ), + ), + ); + }); }); } From 049a31819e54216a8e9b2f7ca594985975662664 Mon Sep 17 00:00:00 2001 From: Sixtus Agbo Date: Fri, 29 Mar 2024 00:39:15 +0100 Subject: [PATCH 5/7] Add test url constant --- test/providers/ui_providers_test.dart | 14 ++++++-------- test/test_consts.dart | 4 +++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/providers/ui_providers_test.dart b/test/providers/ui_providers_test.dart index 1c4fde90..94a326ef 100644 --- a/test/providers/ui_providers_test.dart +++ b/test/providers/ui_providers_test.dart @@ -19,6 +19,8 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; +import '../test_consts.dart'; + void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -389,8 +391,7 @@ void main() { of: find.byType(URLField), matching: find.byType(TextFormField), ); - const url = 'https://api.foss42.com/country/codes'; - await tester.enterText(field, url); + await tester.enterText(field, kTestUrl); await tester.pump(); // Tap on the "Send" button @@ -434,8 +435,7 @@ void main() { of: find.byType(URLField), matching: find.byType(TextFormField), ); - const url = 'https://api.foss42.com/country/codes'; - await tester.enterText(field, url); + await tester.enterText(field, kTestUrl); await tester.pump(); // Tap on the "Send" button @@ -483,8 +483,7 @@ void main() { of: find.byType(URLField), matching: find.byType(TextFormField), ); - const url = 'https://api.foss42.com/country/codes'; - await tester.enterText(field, url); + await tester.enterText(field, kTestUrl); await tester.pump(); // Tap on the "Send" button @@ -541,8 +540,7 @@ void main() { of: find.byType(URLField), matching: find.byType(TextFormField), ); - const url = 'https://api.foss42.com/country/codes'; - await tester.enterText(field, url); + await tester.enterText(field, kTestUrl); await tester.pump(); // Tap on the "Send" button diff --git a/test/test_consts.dart b/test/test_consts.dart index f0a9b779..08e2c7e3 100644 --- a/test/test_consts.dart +++ b/test/test_consts.dart @@ -1,5 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; final kThemeDataDark = ThemeData( useMaterial3: true, @@ -570,3 +570,5 @@ Uint8List kBodyBytesJpeg = Uint8List.fromList([ 255, 217 ]); + +const kTestUrl = 'https://api.apidash.dev/country/codes'; From 281dcaf06a23b7a737b4f7ff1cfd4958881e65ef Mon Sep 17 00:00:00 2001 From: Ankit Mahato Date: Fri, 29 Mar 2024 19:13:28 +0530 Subject: [PATCH 6/7] Update http_service.dart --- lib/services/http_service.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/services/http_service.dart b/lib/services/http_service.dart index 35a45e36..dec0b516 100644 --- a/lib/services/http_service.dart +++ b/lib/services/http_service.dart @@ -1,11 +1,10 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; - -import 'package:apidash/consts.dart'; -import 'package:apidash/models/models.dart'; -import 'package:apidash/utils/utils.dart'; import 'package:http/http.dart' as http; +import 'package:apidash/utils/utils.dart'; +import 'package:apidash/models/models.dart'; +import 'package:apidash/consts.dart'; Future<(http.Response?, Duration?, String?)> request( RequestModel requestModel, { From 7c3b3119f5c311a3d0304075a7743d2bf387a408 Mon Sep 17 00:00:00 2001 From: Ankit Mahato Date: Fri, 29 Mar 2024 19:22:07 +0530 Subject: [PATCH 7/7] Update test_consts.dart --- test/test_consts.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_consts.dart b/test/test_consts.dart index 08e2c7e3..6ef47887 100644 --- a/test/test_consts.dart +++ b/test/test_consts.dart @@ -13,6 +13,8 @@ final kThemeDataLight = ThemeData( brightness: Brightness.light, ); +const kTestUrl = 'https://api.apidash.dev'; + Uint8List kBodyBytesJpeg = Uint8List.fromList([ 255, 216, @@ -570,5 +572,3 @@ Uint8List kBodyBytesJpeg = Uint8List.fromList([ 255, 217 ]); - -const kTestUrl = 'https://api.apidash.dev/country/codes';