Developer

Platform Service switcher

This package allows you to swap platform Huawei or Google services dependencies for app build. You can automate this with the VSCode tasks.


!CAUTION This package is obsolete and only used by Mobi Mobile app. Same functionality was moved to Eli

Installation

dart pub global activate services  --hosted-url=https://gitea.whitelabel.mobile.embedit.dev/api/packages/platform/pub/

You need access token for fetching from private pub repository. ELI add token automatically

Usage

ess -h
Platform Services switcher.

Usage: services <command> [arguments]

Global options:
-h, --help            Print this usage information.
-f, --[no-]force      Force run `flutter pub get`
-v, --[no-]verbose    Prints verbose logs.

Available commands:
  google   Switch app to use Google specific packages
  huawei   Switch app to use Huawei specific packages

Run "services help <command>" for more information about a command.

Configuration

Packages example

Create package with specific implementation for service

mkdir services
dart create -t package package_name services/huawei
dart create -t package package_name services/google

Config file

Create your configuration file pubspec_services.yaml in the root of the project

touch pubspec_services.yaml

Put you configuration

services:
  google:
    package_name:
      path: services/google/package_name
    ...
  huawei:
    package_name:
      path: services/huawei/package_name
    ...

Set hooks to melos.yaml

packages:
#  - services/** - never include to the packages, for pub get use hooks
ignore:
  - services/**
command:
  bootstrap:
    hooks:
      post: |
        ess get
        ....

Visual Studio Code

we can add prelaunch task before launch task

create or edit new file .vscode/tasks.json

if you are using FVM then use command fvm instead of ess

{
    "version": "2.0.0",
    "tasks": [{
        "label": "huawei_services",
        "detail": "Switch project to use Huawei Services",
        "command": "fvm", // Could be any other shell command
        "args": ["exec", "ess", "huawei", "-f"],
        "type": "shell",
        "presentation": {
            "reveal": "silent",
            "revealProblems": "onProblem",
            "panel": "shared",
            "clear": true,
            "echo": false,
          }
    },{
        "label": "google_services",
        "detail": "Switch project to use Google Services",
        "command": "fvm", // Could be any other shell command
        "args": ["exec", "ess","google", "-f"],
        "type": "shell",
        "presentation": {
            "reveal": "silent",
            "revealProblems": "onProblem",
            "panel": "shared",
            "clear": true,
            "echo": false,
        },
    }]
}

!TIP For the project without FVM use as a command ess instead of fvm

{
    "version": "2.0.0",
    "tasks": [{
        "command": "ess", // Could be any other shell command
        "args": ["huawei", "-f"],
        ...
    }]
...
}

update your .vscode/launch.json

{
  "version": "0.2.0",
  "configurations": [
   
    {
      "name": "DEV: Develop",
      "request": "launch",
      "type": "dart",
      "program": "lib/main.dart",
      "preLaunchTask": "google_services",
      "args": [
        "--flavor",
        "googleDevelopment"
      ],
      "toolArgs": [
        "--dart-define-from-file",
        ".env/development.json",
        "--dart-define-from-file",
        ".env/secrets/development.json"
      ]
    },
    ...
  ]
}

Switch

We are using this tool for switching services dependencies in our platform project. If you want to change dependencies witch services for huawei or google

# switch dependencies with huawei services
ess huawei 

# switch dependencies with google services
ess google

Copyright © 2025. All rights reserved.