-
Notifications
You must be signed in to change notification settings - Fork 1
Configuration
In this section, we will explore how to configure the app settings in two ways: programmatically through the constructor or via a JSON file. The configuration section provides a comprehensive overview of the existing properties and their respective purposes.
Flutter JVx supports different ways to be configured:
- Directly in the constructor via the
appConfig
parameter. - Via a json file in
assets/config/app.conf.json
.- We also support a special
dev.conf.json
in the same directory.
This config should only be used during development as it overwrites the user settings on every start.
- We also support a special
{
"title": "JVx Mobile Demo",
"privacyPolicy": "https://visionx.sibvisions.com/privacy-policy/",
"connectTimeout": 5000,
"aliveInterval": 30000,
"wsPingInterval": 10000,
"autoRestartOnSessionExpired": true,
"showAppOverviewWithoutDefault": false,
"customAppsAllowed": true,
"forceSingleAppMode": false,
"serverConfigsLocked": false,
"serverConfigsParametersHidden": false,
"logConfig": {
"levels": {
"general": "info",
"api": "info",
"command": "info",
"ui": "info",
"layout": "info"
}
},
"uiConfig": {
"hideLanguageSetting": false,
"hidePictureSizeSetting": false,
"hideThemeSetting": false,
"showRememberMe": true,
"rememberMeChecked": true
},
"serverConfigs": [
{
"baseUrl": "http://localhost:8888/JVx.mobile/services/mobile",
"appName": "demo",
"username": "features",
"password": "features",
"icon": "https://upload.wikimedia.org/wikipedia/commons/a/a6/Jvx_2020.png",
"locked": false,
"parametersHidden": false
}
],
"versionConfig": {
"commit": "c07e26e1",
"buildDate": 946681200,
"buildNumber": 56
}
}
void main() {
FlutterUI.start(
FlutterUI(
appConfig: AppConfig(
title: "JVx Mobile Demo",
connectTimeout: const Duration(seconds: 10),
customAppsAllowed: true,
serverConfigs: [
ServerConfig(
baseUrl: Uri.parse('http://localhost:8888/JVx.mobile/services/mobile'),
appName: 'demo',
),
],
logConfig: const LogConfig(
levels: LogLevelConfig(
general: Level.info,
api: Level.info,
command: Level.info,
ui: Level.info,
layout: Level.info,
),
),
versionConfig: const VersionConfig(
commit: "c07e26e1",
buildDate: 946681200,
buildNumber: 56,
),
),
),
);
}
The detected app configurations are applied on top of each other in the following order:
-
appConfig
from theFlutterUI
constructor. -
app.conf.json
file from assets. -
dev.conf.json
file from assets. (Optional and not recommended for production)
The later one appears in the list, the more priority it gets, that means that a property defined in the json file will always override the one from the constructor config, and so on.
Every property is either allowed to be null or has a default value defined.
-
marks that there is no default value.
Property | Type | Default | Description |
---|---|---|---|
title | String | JVx Mobile | A one-line title that is used to identify the app for the user. On the web this parameter is only used when no applicationTitleWeb is set. |
privacyPolicy | Uri | - | A link that enables a hyperlink button in the settings page. |
connectTimeout | Duration in ms | 10s | The timeout used by the HTTP Client for the initial connection and the WebSocket. |
requestTimeout | Duration in ms | connectTimeout |
The timeout used by the HTTP Client for the read and write operations. |
aliveInterval | Duration in ms | 30s | The interval at which an "Alive" request is sent while no other requests are sent. |
wsPingInterval | Duration in ms | 10s | The interval at which the websocket will send a PING message and wait for a PONG response. |
autoRestartOnSessionExpired | bool | true | Whether the app auto restarts as soon as an expired session is encountered. Otherwise a dialog is shown. |
showAppOverviewWithoutDefault | bool | false | Whether the app overview should be shown when there is a single app which is not marked as default. |
customAppsAllowed | bool | true | Whether custom apps are allowed. |
forceSingleAppMode | bool | false | Whether the single app mode is forced. |
predefinedConfigsLocked | bool | true | Whether the predefined apps in the app overview are editable by the user. |
predefinedConfigsParametersHidden | bool | true | Whether parameters such as App name or Base URL of predefined apps are shown to the user. |
serverConfigsLocked | bool | true | (JSON only) Whether the predefined apps in the app overview are editable by the user. |
serverConfigsParametersHidden | bool | true | (JSON only) Whether parameters such as App name or Base URL of predefined apps are shown to the user. |
The default log level is defined as Level.info
while in debug mode and Level.warning
in profile
and production mode.
Property | Type | Description |
---|---|---|
general | Log Level | the log level used for the general logger |
api | Log Level | the log level used for the API logger |
command | Log Level | the log level used for the command logger |
ui | Log Level | the log level used for the UI logger |
layout | Log Level | the log level used for the UI logger |
Level | Usage |
---|---|
all | Logs everything |
trace | Trace log |
debug | Debug log |
info | Info log |
warning | Warning log |
error | Error log |
fatal | Fatal log |
off | Logs nothing |
More information about the logger in use: https://pub.dev/packages/logger
Property | Type | Default | Description |
---|---|---|---|
hideLanguageSetting | bool | false | Whether the language switch should be visible in Settings page. |
hidePictureSizeSetting | bool | false | Whether the picture size switch should be visible in Settings page. |
hideThemeSetting | bool | false | Whether the theme mode switch should be visible in Settings page. |
showRememberMe | bool | false | Whether a "Remember me?" checkbox is shown in the Login view. |
rememberMeChecked | bool | false | Whether the "Remember me?" checkbox is checked by default. |
Property | Type | Description |
---|---|---|
appName | String | The application name defined by the JVx server. |
baseUrl | String | The Base URL used to connect to the JVx server. |
username | String | Optional username for auto-login. |
password | String | Optional password for auto-login. |
title | String | The title as shown in the App overview for this app. |
icon | String | URL or JVx resource path to an icon. |
default | bool | Whether this app should be marked as default. |
locked | bool | Whether this app is editable in the app overview. |
parametersHidden | bool | Whether appName or baseUrl are shown to the user. |
Property | Type | Default | Description |
---|---|---|---|
commit | String | - | The Repository Commit Signature that is shown in the settings page. |
buildDate | String or Epoch Milliseconds | - | The build date string that is shown in the settings page. |
buildNumber | int | - | The build number that is shown in the settings page. |
Example of a version config visible in the settings:

Property | Type | Default | Description |
---|---|---|---|
checkConstraints | bool | true | Whether data constraints sent by the server are respected while in offline mode. |