dynamic_base_url_and_force_update 1.0.4 copy "dynamic_base_url_and_force_update: ^1.0.4" to clipboard
dynamic_base_url_and_force_update: ^1.0.4 copied to clipboard

Dynamic Change Base Url & Feature Force Update New Version From Google Play and Apple Store

App Setting Dynamic Change "Domain" and "Force Update Dialog Popup" #



Features : #

Dynamic Change Base Url & Feature Force Update New Version From Google Play and Apple Store" #



Screenshots Result : #

Force Update #

Force Update Google Play or Apple Store

Postman Get Data #

postman_get_app_setting

Guide For Backend Developer: #

1- Config Firebase Authentication : #

firebase_enable_auth_by_email
  • create account
- Email   :
developer.firebase@yourdomain.com

- Password   account:" 
12345678

firebase_create_user_email

Notice: This password for testing mode, don't forget to change it in live #

2- create realtime database, set rules (copy/past) : #

{
  "rules": {
    "app_setting": {
      ".read": "true",
      ".write": "auth != null && auth.token.email == 'developer.firebase@yourdomain.com'",
      
    }
  }
}

firebase_create_rules

3- create realtime database data : #

  • manuel create data at path /app_setting/
{
    "base_url_dynamic": "http://new.com",
    "min_version_ios": 116,
    "mmin_version_android": 116
}
firebase_create_data

4- To update from Postman RESTFul api #

Config at HTTP Request : #

postman_update_header

How to Get URL Of Your ProjectId Of firebase:

firebase_create_data

How to Get dynamic app setting : #

postman_get_app_setting

How to get Access Token Firebase : #

  • Access Token Firebase : Needed to be allowed in edit information of baseUrl or ForceUpdate Version or another.
  1. Get Web API KEY:
  • Firebase project's Web API key (from Firebase Console → Project Settings → General → Web API Key
  • Register new <> web application, will show value here : const firebaseConfig = { apiKey: "AIza************************", ..... }
firebase_web_config
  1. in postman http request : POST https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=YOUR_WEB_API_
  • payload :
{
  "email": "developer.firebase@yourdomain.com",
  "password": "12345678",
  "returnSecureToken": true
}
postman_get_access_token
  • postman save variable >> script tab >> post response (copy/past):
  
let responseData = pm.response.json();
pm.environment.set("firebase_access_token_admin", responseData.idToken);
 

( the above code show the "idToken" will be saved at variable named "firebase_access_token_admin" )

postman_get_access_set_variable

How to update min version ( force update feature ) : #

  • payload
{
    "min_version_ios": 116,
    "mmin_version_android": 116
}
postman_update_force_update

How to update base url dynamic : #

  • payload
{
    "base_url_dynamic":  "https://new.com"
}
postman_update_baseurl_dynamic

Guide For Mobile Developer : #

Config In Flutter: #

1. How to Get URL with ProjectId firebase: #

2. Set method reRegister in "di" ( Optional For DependentInjection ) #

( skip this step in case you not set "dio" at "di" )

  • At your code class "Di" DependentInjection, update "Dio Helper" class
Future reRegisterDependentInjectionForDioHelper() async {
  // Step 2: Unregister the previous one if already registered
  if (sl.isRegistered<ApiUtil>()) {
    print("reRegisterDependentInjectionForDioHelper() - Unregister the previous one");
    sl.unregister<ApiUtil>();
  }
  /// network
  ApiUtil api = await ApiUtil.instance();
  sl.registerLazySingleton<ApiUtil>(() => api);
}

3. in main method write : #

  • before call the "di" dependence injection , set default baseUrl:
  /// before init Dio Helper Config 
  ///    >> example if you using dependant   indjection 
  ///        must to set baseUrl default before init dio helper class
  AppSettingDynamicInstaller.setConfigBaseUrls(
    domainDefault: 'https://test4.maqsafy.com',
    firebaseBaseUrl: "https://maqsafy-egypt-default-rtdb.asia-southeast1.firebasedatabase.app",
  );

( If app not have "DI" write before runApp() at any line)

  • wrap MyApp() in case there, then update "di/dio helper"
  runApp( AppSettingDynamicRunApp(
      currentVersionValidateForForceUpdate: versionDevelopment,
      linkUpdateApplestore: "https://apps.apple.com/ag/app/%D9%85%D9%82%D8%B5%D9%81%D9%8A/id1493287507",
      linkUpdateGoogleplay:  "https://play.google.com/store/apps/details?id=com.maqsafy",
      onNeedUpdateDioHelperBaseUrl: (){
        /// (Optional In Case Use "DI" )update "di" dependant inject of baseurl
        di.reRegisterDependentInjectionForDioHelper();
      },
      builder: (context)   {
        return myApp;
      },
  ));

4. In Video Splash Screen #

  • in case you have video splash screen, we can save time of user, while user watching on video splash we download data of Setting Dynamic

- example: we assume you have screen called "SplashVideoScreen.dart" type WidgetStateFull

  • Code at initState() :
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { 
      await setupAppSettingDynamicListener(); 
    });
  }

  setupAppSettingDynamicListener() async {
    await AppSettingDynamicInstaller.addOnCompleteSplash( ( response ) {

        /// case:  video in progress, while api setting completed before video
        if(isVideoSplashCompleted  == false ) {
          return;

          /// case:  video completed, while api setting completed after video
        } else {
          chooseNextPageLive();
        }

      });
  }

  • Code at video player controller listener
  • set the "isVideoSplashCompleted" to be true, when video controller say it's completed video showing
  listenerVideoCompleted() async {
      
      isVideoSplashCompleted = true;

      if( AppSettingDynamicInstaller.isCompleteDownloadData() ){
          navigateToHome();
      }
    }
  }
  • Notice : method "navigateToHome();" make Navigate to screen after splash, example home screen

5- How To Get New BaseUrl Domain Dynamic #

  • Get BaseUrl dynamic
var baseUrl = AppSettingDynamicInstaller.getDomain(); 
  • How to get From Endpoint Variable

=> old way

static String baseUrlv2 = '${AppSettingDynamicInstaller.getDomain()}/api/v2/';

=> New way get dynamic using method return "=>"

  static String baseUrlv2() =>  AppSettingDynamicInstaller.getDomain() + '/api/v2/';

(Notice: need to remove "static" or change static filed to method function . Due to static fields are initialized only once when the class is first loaded into memory. )

Use at Any Framework : Like Native kotlin or swift : #



Developed By Company MASARAT #

Company #

MASARAT
Linkedin
Website

Team Member #

Teach Lead
Elamir Mahmoud
Linkedin
at MASARAT company

Created by Flutter Developer
Abdallah Mahmoud
Linkedin
at MASARAT company



MASARAT Proprietary Software License #

MASARAT Proprietary Software License

Copyright © 2025 MASARAT Company. All rights reserved.

This software is licensed, not sold. By downloading or using this software, you agree to the following terms:

1. Permitted Use
   You are granted a non-exclusive, non-transferable, revocable license to download and use this software only in its original form for personal or internal business purposes.

2. Restrictions
   You may not, under any circumstance:
   - Copy or reproduce any part of the software or its source code.
   - Modify, adapt, translate, reverse-engineer, decompile, or disassemble the software.

3. Ownership
   All rights, title, and interest in and to the software remain the exclusive property of MASARAT.

4. Termination
   This license is effective until terminated. It will terminate automatically without notice if you breach any of its terms. Upon termination, you must cease all use and delete all copies.

5. No Warranty
   This software is provided "as is", without warranty of any kind. MASARAT shall not be liable for any damages resulting from its use.

1
likes
100
points
48
downloads

Publisher

unverified uploader

Weekly Downloads

Dynamic Change Base Url & Feature Force Update New Version From Google Play and Apple Store

Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

dio, flutter, flutter_web_plugins, plugin_platform_interface, url_launcher, web

More

Packages that depend on dynamic_base_url_and_force_update

Packages that implement dynamic_base_url_and_force_update