override_api_endpoint Overrides and persists default API endpoint for the test environment.
The deeplinkOverrideSegment is the part of deeplink that uniquely identifies deeplink that is used to override API endpoint eg. override in app://app/override?apiAddress=https%3A%2F%2Fexample.com
The deeplinkQueryParameter is the query parameter of the override API endpoint deeplink that contains url encoded API endpoint to be used eg. apiAddress in app://app/override?apiAddress=https%3A%2F%2Fexample.com
The defaultEndpoint is fallback url that should be used if app does not have any endpoint introduced via deeplink or if deeplinkQueryParameter is not provided
final apiEndpoint = await overrideApiEndpoint(
'override',
'apiAddress',
Uri.parse('https://api.example.com/'),
);
Run this command:
With Dart:
$ dart pub add override_api_endpoint
With Flutter:
$ flutter pub add override_api_endpoint
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
override_api_endpoint: ^1.0.0
Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:override_api_endpoint/override_api_endpoint.dart';