Compare commits

...

7 Commits

Author SHA1 Message Date
Zack Pollard
eabf535246 wip: pmtiles server 2024-09-24 13:05:19 +01:00
Zack Pollard
b0947bf9b9 feat: serve map tile styles from tiles.immich.cloud (#12858)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
2024-09-24 13:05:17 +01:00
Daniel Dietzler
5ea3b5a5c1 fix: open api (#12878) 2024-09-24 13:05:15 +01:00
Jason Rasmussen
ded18f3b6b refactor(mobile): open api dto upgrade (#12793) 2024-09-24 13:05:15 +01:00
Jason Rasmussen
3724dc465b fix: remove no longer needed LD_LIBRARY_PATH (#12872) 2024-09-24 13:05:15 +01:00
Daniel Dietzler
91b07fbac8 fix: show asset count for unassigned faces (#12871) 2024-09-24 13:05:15 +01:00
Zack Pollard
fe84f1cc90 wip: local tileserver 2024-09-23 23:10:45 +01:00
234 changed files with 7380 additions and 1192 deletions

View File

@@ -25,6 +25,7 @@ server/upload/
server/src/queries
server/dist/
server/www/
server/resources/v1.pmtiles
web/node_modules/
web/coverage/

View File

@@ -24,6 +24,7 @@ services:
- ${UPLOAD_LOCATION}/photos/upload:/usr/src/app/upload/upload
- /usr/src/app/node_modules
- /etc/localtime:/etc/localtime:ro
- ../server/resources/v1.pmtiles:/usr/src/app/resources/v1.pmtiles
env_file:
- .env
environment:

View File

@@ -51,5 +51,4 @@ services:
volumes:
- /usr/lib/wsl:/usr/lib/wsl
environment:
- LD_LIBRARY_PATH=/usr/lib/wsl/lib
- LIBVA_DRIVER_NAME=d3d12

6
e2e/package-lock.json generated
View File

@@ -5016,9 +5016,9 @@
}
},
"node_modules/path-to-regexp": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz",
"integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==",
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz",
"integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==",
"dev": true
},
"node_modules/pathe": {

View File

@@ -1,8 +1,7 @@
import { AssetMediaResponseDto, LoginResponseDto, SharedLinkType } from '@immich/sdk';
import { LoginResponseDto } from '@immich/sdk';
import { readFile } from 'node:fs/promises';
import { basename, join } from 'node:path';
import { Socket } from 'socket.io-client';
import { createUserDto } from 'src/fixtures';
import { errorDto } from 'src/responses';
import { app, testAssetDir, utils } from 'src/utils';
import request from 'supertest';
@@ -11,18 +10,13 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
describe('/map', () => {
let websocket: Socket;
let admin: LoginResponseDto;
let nonAdmin: LoginResponseDto;
let asset: AssetMediaResponseDto;
beforeAll(async () => {
await utils.resetDatabase();
admin = await utils.adminSetup({ onboarding: false });
nonAdmin = await utils.userSetup(admin.accessToken, createUserDto.user1);
websocket = await utils.connectWebsocket(admin.accessToken);
asset = await utils.createAsset(admin.accessToken);
const files = ['formats/heic/IMG_2682.heic', 'metadata/gps-position/thompson-springs.jpg'];
utils.resetEvents();
const uploadFile = async (input: string) => {
@@ -103,63 +97,6 @@ describe('/map', () => {
});
});
describe('GET /map/style.json', () => {
it('should require authentication', async () => {
const { status, body } = await request(app).get('/map/style.json');
expect(status).toBe(401);
expect(body).toEqual(errorDto.unauthorized);
});
it('should allow shared link access', async () => {
const sharedLink = await utils.createSharedLink(admin.accessToken, {
type: SharedLinkType.Individual,
assetIds: [asset.id],
});
const { status, body } = await request(app).get(`/map/style.json?key=${sharedLink.key}`).query({ theme: 'dark' });
expect(status).toBe(200);
expect(body).toEqual(expect.objectContaining({ id: 'immich-map-dark' }));
});
it('should throw an error if a theme is not light or dark', async () => {
for (const theme of ['dark1', true, 123, '', null, undefined]) {
const { status, body } = await request(app)
.get('/map/style.json')
.query({ theme })
.set('Authorization', `Bearer ${admin.accessToken}`);
expect(status).toBe(400);
expect(body).toEqual(errorDto.badRequest(['theme must be one of the following values: light, dark']));
}
});
it('should return the light style.json', async () => {
const { status, body } = await request(app)
.get('/map/style.json')
.query({ theme: 'light' })
.set('Authorization', `Bearer ${admin.accessToken}`);
expect(status).toBe(200);
expect(body).toEqual(expect.objectContaining({ id: 'immich-map-light' }));
});
it('should return the dark style.json', async () => {
const { status, body } = await request(app)
.get('/map/style.json')
.query({ theme: 'dark' })
.set('Authorization', `Bearer ${admin.accessToken}`);
expect(status).toBe(200);
expect(body).toEqual(expect.objectContaining({ id: 'immich-map-dark' }));
});
it('should not require admin authentication', async () => {
const { status, body } = await request(app)
.get('/map/style.json')
.query({ theme: 'dark' })
.set('Authorization', `Bearer ${nonAdmin.accessToken}`);
expect(status).toBe(200);
expect(body).toEqual(expect.objectContaining({ id: 'immich-map-dark' }));
});
});
describe('GET /map/reverse-geocode', () => {
it('should require authentication', async () => {
const { status, body } = await request(app).get('/map/reverse-geocode');

View File

@@ -128,6 +128,8 @@ describe('/server-info', () => {
isInitialized: true,
externalDomain: '',
isOnboarded: false,
mapDarkStyleUrl: 'https://tiles.immich.cloud/v1/style/dark.json',
mapLightStyleUrl: 'https://tiles.immich.cloud/v1/style/light.json',
});
});
});

View File

@@ -134,6 +134,8 @@ describe('/server', () => {
isInitialized: true,
externalDomain: '',
isOnboarded: false,
mapDarkStyleUrl: 'https://tiles.immich.cloud/v1/style/dark.json',
mapLightStyleUrl: 'https://tiles.immich.cloud/v1/style/light.json',
});
});
});

View File

@@ -1,5 +1,5 @@
{
"dart.flutterSdkPath": ".fvm/versions/3.24.0",
"dart.flutterSdkPath": ".fvm/versions/3.24.3",
"search.exclude": {
"**/.fvm": true
},

View File

@@ -4,11 +4,15 @@ class ServerConfig {
final int trashDays;
final String oauthButtonText;
final String externalDomain;
final String mapDarkStyleUrl;
final String mapLightStyleUrl;
const ServerConfig({
required this.trashDays,
required this.oauthButtonText,
required this.externalDomain,
required this.mapDarkStyleUrl,
required this.mapLightStyleUrl,
});
ServerConfig copyWith({
@@ -20,6 +24,8 @@ class ServerConfig {
trashDays: trashDays ?? this.trashDays,
oauthButtonText: oauthButtonText ?? this.oauthButtonText,
externalDomain: externalDomain ?? this.externalDomain,
mapDarkStyleUrl: mapDarkStyleUrl,
mapLightStyleUrl: mapLightStyleUrl,
);
}
@@ -30,7 +36,9 @@ class ServerConfig {
ServerConfig.fromDto(ServerConfigDto dto)
: trashDays = dto.trashDays,
oauthButtonText = dto.oauthButtonText,
externalDomain = dto.externalDomain;
externalDomain = dto.externalDomain,
mapDarkStyleUrl = dto.mapDarkStyleUrl,
mapLightStyleUrl = dto.mapLightStyleUrl;
@override
bool operator ==(covariant ServerConfig other) {

View File

@@ -1,4 +1,5 @@
import 'dart:math';
import 'package:auto_route/auto_route.dart';
import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -7,27 +8,27 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:geolocator/geolocator.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/entities/asset.entity.dart';
import 'package:immich_mobile/extensions/asyncvalue_extensions.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/latlngbounds_extension.dart';
import 'package:immich_mobile/extensions/maplibrecontroller_extensions.dart';
import 'package:immich_mobile/models/map/map_event.model.dart';
import 'package:immich_mobile/models/map/map_marker.model.dart';
import 'package:immich_mobile/providers/db.provider.dart';
import 'package:immich_mobile/providers/map/map_marker.provider.dart';
import 'package:immich_mobile/providers/map/map_state.provider.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/utils/debounce.dart';
import 'package:immich_mobile/utils/immich_loading_overlay.dart';
import 'package:immich_mobile/utils/map_utils.dart';
import 'package:immich_mobile/widgets/asset_grid/asset_grid_data_structure.dart';
import 'package:immich_mobile/widgets/common/immich_toast.dart';
import 'package:immich_mobile/widgets/map/map_app_bar.dart';
import 'package:immich_mobile/widgets/map/map_asset_grid.dart';
import 'package:immich_mobile/widgets/map/map_bottom_sheet.dart';
import 'package:immich_mobile/widgets/map/map_theme_override.dart';
import 'package:immich_mobile/widgets/map/positioned_asset_marker_icon.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/entities/asset.entity.dart';
import 'package:immich_mobile/providers/db.provider.dart';
import 'package:immich_mobile/widgets/common/immich_toast.dart';
import 'package:immich_mobile/utils/immich_loading_overlay.dart';
import 'package:immich_mobile/utils/debounce.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
@RoutePage()
@@ -304,7 +305,7 @@ class MapPage extends HookConsumerWidget {
),
Positioned(
right: 0,
bottom: MediaQuery.of(context).padding.bottom + 16,
bottom: MediaQuery.paddingOf(context).bottom + 16,
child: ElevatedButton(
onPressed: onZoomToLocation,
style: ElevatedButton.styleFrom(

View File

@@ -1,28 +1,23 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:immich_mobile/extensions/response_extensions.dart';
import 'package:immich_mobile/models/map/map_state.model.dart';
import 'package:immich_mobile/providers/app_settings.provider.dart';
import 'package:immich_mobile/providers/server_info.provider.dart';
import 'package:immich_mobile/services/app_settings.service.dart';
import 'package:immich_mobile/providers/api.provider.dart';
import 'package:logging/logging.dart';
import 'package:openapi/api.dart';
import 'package:path_provider/path_provider.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'map_state.provider.g.dart';
@Riverpod(keepAlive: true)
class MapStateNotifier extends _$MapStateNotifier {
final _log = Logger("MapStateNotifier");
@override
MapState build() {
final appSettingsProvider = ref.read(appSettingsServiceProvider);
// Fetch and save the Style JSONs
loadStyles();
final lightStyleUrl =
ref.read(serverInfoProvider).serverConfig.mapLightStyleUrl;
final darkStyleUrl =
ref.read(serverInfoProvider).serverConfig.mapDarkStyleUrl;
return MapState(
themeMode: ThemeMode.values[
appSettingsProvider.getSetting<int>(AppSettingsEnum.mapThemeMode)],
@@ -34,65 +29,11 @@ class MapStateNotifier extends _$MapStateNotifier {
appSettingsProvider.getSetting<bool>(AppSettingsEnum.mapwithPartners),
relativeTime:
appSettingsProvider.getSetting<int>(AppSettingsEnum.mapRelativeDate),
lightStyleFetched: AsyncData(lightStyleUrl),
darkStyleFetched: AsyncData(darkStyleUrl),
);
}
void loadStyles() async {
final documents = (await getApplicationDocumentsDirectory()).path;
// Set to loading
state = state.copyWith(lightStyleFetched: const AsyncLoading());
// Fetch and save light theme
final lightResponse = await ref
.read(apiServiceProvider)
.mapApi
.getMapStyleWithHttpInfo(MapTheme.light);
if (lightResponse.statusCode >= HttpStatus.badRequest) {
state = state.copyWith(
lightStyleFetched: AsyncError(lightResponse.body, StackTrace.current),
);
_log.severe(
"Cannot fetch map light style",
lightResponse.toLoggerString(),
);
return;
}
final lightJSON = lightResponse.body;
final lightFile = await File("$documents/map-style-light.json")
.writeAsString(lightJSON, flush: true);
// Update state with path
state =
state.copyWith(lightStyleFetched: AsyncData(lightFile.absolute.path));
// Set to loading
state = state.copyWith(darkStyleFetched: const AsyncLoading());
// Fetch and save dark theme
final darkResponse = await ref
.read(apiServiceProvider)
.mapApi
.getMapStyleWithHttpInfo(MapTheme.dark);
if (darkResponse.statusCode >= HttpStatus.badRequest) {
state = state.copyWith(
darkStyleFetched: AsyncError(darkResponse.body, StackTrace.current),
);
_log.severe("Cannot fetch map dark style", darkResponse.toLoggerString());
return;
}
final darkJSON = darkResponse.body;
final darkFile = await File("$documents/map-style-dark.json")
.writeAsString(darkJSON, flush: true);
// Update state with path
state = state.copyWith(darkStyleFetched: AsyncData(darkFile.absolute.path));
}
void switchTheme(ThemeMode mode) {
ref.read(appSettingsServiceProvider).setSetting(
AppSettingsEnum.mapThemeMode,

View File

@@ -34,6 +34,9 @@ class ServerInfoNotifier extends StateNotifier<ServerInfo> {
trashDays: 30,
oauthButtonText: '',
externalDomain: '',
mapLightStyleUrl:
'https://tiles.immich.cloud/v1/style/light.json',
mapDarkStyleUrl: 'https://tiles.immich.cloud/v1/style/dark.json',
),
serverDiskInfo: const ServerDiskInfo(
diskAvailable: "0",

View File

@@ -12,6 +12,19 @@ dynamic upgradeDto(dynamic value, String targetType) {
addDefault(value, 'tags', TagsResponse().toJson());
}
break;
case 'ServerConfigDto':
if (value is Map) {
addDefault(
value,
'mapLightStyleUrl',
'https://tiles.immich.cloud/v1/style/light.json',
);
addDefault(
value,
'mapDarkStyleUrl',
'https://tiles.immich.cloud/v1/style/dark.json',
);
}
case 'UserResponseDto':
if (value is Map) {
addDefault(value, 'profileChangedAt', DateTime.now().toIso8601String());

View File

@@ -138,7 +138,6 @@ Class | Method | HTTP request | Description
*LibrariesApi* | [**updateLibrary**](doc//LibrariesApi.md#updatelibrary) | **PUT** /libraries/{id} |
*LibrariesApi* | [**validate**](doc//LibrariesApi.md#validate) | **POST** /libraries/{id}/validate |
*MapApi* | [**getMapMarkers**](doc//MapApi.md#getmapmarkers) | **GET** /map/markers |
*MapApi* | [**getMapStyle**](doc//MapApi.md#getmapstyle) | **GET** /map/style.json |
*MapApi* | [**reverseGeocode**](doc//MapApi.md#reversegeocode) | **GET** /map/reverse-geocode |
*MemoriesApi* | [**addMemoryAssets**](doc//MemoriesApi.md#addmemoryassets) | **PUT** /memories/{id}/assets |
*MemoriesApi* | [**createMemory**](doc//MemoriesApi.md#creatememory) | **POST** /memories |
@@ -348,7 +347,6 @@ Class | Method | HTTP request | Description
- [ManualJobName](doc//ManualJobName.md)
- [MapMarkerResponseDto](doc//MapMarkerResponseDto.md)
- [MapReverseGeocodeResponseDto](doc//MapReverseGeocodeResponseDto.md)
- [MapTheme](doc//MapTheme.md)
- [MemoriesResponse](doc//MemoriesResponse.md)
- [MemoriesUpdate](doc//MemoriesUpdate.md)
- [MemoryCreateDto](doc//MemoryCreateDto.md)

View File

@@ -159,7 +159,6 @@ part 'model/logout_response_dto.dart';
part 'model/manual_job_name.dart';
part 'model/map_marker_response_dto.dart';
part 'model/map_reverse_geocode_response_dto.dart';
part 'model/map_theme.dart';
part 'model/memories_response.dart';
part 'model/memories_update.dart';
part 'model/memory_create_dto.dart';

View File

@@ -105,62 +105,6 @@ class MapApi {
return null;
}
/// Performs an HTTP 'GET /map/style.json' operation and returns the [Response].
/// Parameters:
///
/// * [MapTheme] theme (required):
///
/// * [String] key:
Future<Response> getMapStyleWithHttpInfo(MapTheme theme, { String? key, }) async {
// ignore: prefer_const_declarations
final path = r'/map/style.json';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (key != null) {
queryParams.addAll(_queryParams('', 'key', key));
}
queryParams.addAll(_queryParams('', 'theme', theme));
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [MapTheme] theme (required):
///
/// * [String] key:
Future<Object?> getMapStyle(MapTheme theme, { String? key, }) async {
final response = await getMapStyleWithHttpInfo(theme, key: key, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
}
return null;
}
/// Performs an HTTP 'GET /map/reverse-geocode' operation and returns the [Response].
/// Parameters:
///

View File

@@ -166,7 +166,6 @@ class ApiClient {
/// Returns a native instance of an OpenAPI class matching the [specified type][targetType].
static dynamic fromJson(dynamic value, String targetType, {bool growable = false,}) {
upgradeDto(value, targetType);
try {
switch (targetType) {
case 'String':
@@ -373,8 +372,6 @@ class ApiClient {
return MapMarkerResponseDto.fromJson(value);
case 'MapReverseGeocodeResponseDto':
return MapReverseGeocodeResponseDto.fromJson(value);
case 'MapTheme':
return MapThemeTypeTransformer().decode(value);
case 'MemoriesResponse':
return MemoriesResponse.fromJson(value);
case 'MemoriesUpdate':

View File

@@ -100,9 +100,6 @@ String parameterToString(dynamic value) {
if (value is ManualJobName) {
return ManualJobNameTypeTransformer().encode(value).toString();
}
if (value is MapTheme) {
return MapThemeTypeTransformer().encode(value).toString();
}
if (value is MemoryType) {
return MemoryTypeTypeTransformer().encode(value).toString();
}

View File

@@ -78,6 +78,7 @@ class ActivityCreateDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ActivityCreateDto? fromJson(dynamic value) {
upgradeDto(value, "ActivityCreateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -78,6 +78,7 @@ class ActivityResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ActivityResponseDto? fromJson(dynamic value) {
upgradeDto(value, "ActivityResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class ActivityStatisticsResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ActivityStatisticsResponseDto? fromJson(dynamic value) {
upgradeDto(value, "ActivityStatisticsResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class AddUsersDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AddUsersDto? fromJson(dynamic value) {
upgradeDto(value, "AddUsersDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class AdminOnboardingUpdateDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AdminOnboardingUpdateDto? fromJson(dynamic value) {
upgradeDto(value, "AdminOnboardingUpdateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -186,6 +186,7 @@ class AlbumResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AlbumResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AlbumResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -52,6 +52,7 @@ class AlbumStatisticsResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AlbumStatisticsResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AlbumStatisticsResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -56,6 +56,7 @@ class AlbumUserAddDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AlbumUserAddDto? fromJson(dynamic value) {
upgradeDto(value, "AlbumUserAddDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class AlbumUserCreateDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AlbumUserCreateDto? fromJson(dynamic value) {
upgradeDto(value, "AlbumUserCreateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class AlbumUserResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AlbumUserResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AlbumUserResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -118,6 +118,7 @@ class AllJobStatusResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AllJobStatusResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AllJobStatusResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -56,6 +56,7 @@ class APIKeyCreateDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static APIKeyCreateDto? fromJson(dynamic value) {
upgradeDto(value, "APIKeyCreateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class APIKeyCreateResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static APIKeyCreateResponseDto? fromJson(dynamic value) {
upgradeDto(value, "APIKeyCreateResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -64,6 +64,7 @@ class APIKeyResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static APIKeyResponseDto? fromJson(dynamic value) {
upgradeDto(value, "APIKeyResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class APIKeyUpdateDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static APIKeyUpdateDto? fromJson(dynamic value) {
upgradeDto(value, "APIKeyUpdateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -56,6 +56,7 @@ class AssetBulkDeleteDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetBulkDeleteDto? fromJson(dynamic value) {
upgradeDto(value, "AssetBulkDeleteDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -148,6 +148,7 @@ class AssetBulkUpdateDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetBulkUpdateDto? fromJson(dynamic value) {
upgradeDto(value, "AssetBulkUpdateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class AssetBulkUploadCheckDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetBulkUploadCheckDto? fromJson(dynamic value) {
upgradeDto(value, "AssetBulkUploadCheckDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -47,6 +47,7 @@ class AssetBulkUploadCheckItem {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetBulkUploadCheckItem? fromJson(dynamic value) {
upgradeDto(value, "AssetBulkUploadCheckItem");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class AssetBulkUploadCheckResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetBulkUploadCheckResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetBulkUploadCheckResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -88,6 +88,7 @@ class AssetBulkUploadCheckResult {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetBulkUploadCheckResult? fromJson(dynamic value) {
upgradeDto(value, "AssetBulkUploadCheckResult");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class AssetDeltaSyncDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetDeltaSyncDto? fromJson(dynamic value) {
upgradeDto(value, "AssetDeltaSyncDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -52,6 +52,7 @@ class AssetDeltaSyncResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetDeltaSyncResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetDeltaSyncResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -102,6 +102,7 @@ class AssetFaceResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetFaceResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetFaceResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class AssetFaceUpdateDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetFaceUpdateDto? fromJson(dynamic value) {
upgradeDto(value, "AssetFaceUpdateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class AssetFaceUpdateItem {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetFaceUpdateItem? fromJson(dynamic value) {
upgradeDto(value, "AssetFaceUpdateItem");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -92,6 +92,7 @@ class AssetFaceWithoutPersonResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetFaceWithoutPersonResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetFaceWithoutPersonResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -79,6 +79,7 @@ class AssetFullSyncDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetFullSyncDto? fromJson(dynamic value) {
upgradeDto(value, "AssetFullSyncDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class AssetIdsDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetIdsDto? fromJson(dynamic value) {
upgradeDto(value, "AssetIdsDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -56,6 +56,7 @@ class AssetIdsResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetIdsResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetIdsResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class AssetJobsDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetJobsDto? fromJson(dynamic value) {
upgradeDto(value, "AssetJobsDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class AssetMediaResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetMediaResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetMediaResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -293,6 +293,7 @@ class AssetResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -52,6 +52,7 @@ class AssetStackResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetStackResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetStackResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -52,6 +52,7 @@ class AssetStatsResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetStatsResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AssetStatsResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class AuditDeletesResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AuditDeletesResponseDto? fromJson(dynamic value) {
upgradeDto(value, "AuditDeletesResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class AvatarResponse {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AvatarResponse? fromJson(dynamic value) {
upgradeDto(value, "AvatarResponse");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -50,6 +50,7 @@ class AvatarUpdate {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AvatarUpdate? fromJson(dynamic value) {
upgradeDto(value, "AvatarUpdate");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -56,6 +56,7 @@ class BulkIdResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static BulkIdResponseDto? fromJson(dynamic value) {
upgradeDto(value, "BulkIdResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class BulkIdsDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static BulkIdsDto? fromJson(dynamic value) {
upgradeDto(value, "BulkIdsDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class ChangePasswordDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ChangePasswordDto? fromJson(dynamic value) {
upgradeDto(value, "ChangePasswordDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class CheckExistingAssetsDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static CheckExistingAssetsDto? fromJson(dynamic value) {
upgradeDto(value, "CheckExistingAssetsDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class CheckExistingAssetsResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static CheckExistingAssetsResponseDto? fromJson(dynamic value) {
upgradeDto(value, "CheckExistingAssetsResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class CLIPConfig {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static CLIPConfig? fromJson(dynamic value) {
upgradeDto(value, "CLIPConfig");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -68,6 +68,7 @@ class CreateAlbumDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static CreateAlbumDto? fromJson(dynamic value) {
upgradeDto(value, "CreateAlbumDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -68,6 +68,7 @@ class CreateLibraryDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static CreateLibraryDto? fromJson(dynamic value) {
upgradeDto(value, "CreateLibraryDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -52,6 +52,7 @@ class CreateProfileImageResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static CreateProfileImageResponseDto? fromJson(dynamic value) {
upgradeDto(value, "CreateProfileImageResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class DownloadArchiveInfo {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadArchiveInfo? fromJson(dynamic value) {
upgradeDto(value, "DownloadArchiveInfo");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -89,6 +89,7 @@ class DownloadInfoDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadInfoDto? fromJson(dynamic value) {
upgradeDto(value, "DownloadInfoDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class DownloadResponse {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadResponse? fromJson(dynamic value) {
upgradeDto(value, "DownloadResponse");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class DownloadResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadResponseDto? fromJson(dynamic value) {
upgradeDto(value, "DownloadResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -67,6 +67,7 @@ class DownloadUpdate {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadUpdate? fromJson(dynamic value) {
upgradeDto(value, "DownloadUpdate");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -48,6 +48,7 @@ class DuplicateDetectionConfig {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DuplicateDetectionConfig? fromJson(dynamic value) {
upgradeDto(value, "DuplicateDetectionConfig");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class DuplicateResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DuplicateResponseDto? fromJson(dynamic value) {
upgradeDto(value, "DuplicateResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -52,6 +52,7 @@ class EmailNotificationsResponse {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EmailNotificationsResponse? fromJson(dynamic value) {
upgradeDto(value, "EmailNotificationsResponse");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -82,6 +82,7 @@ class EmailNotificationsUpdate {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EmailNotificationsUpdate? fromJson(dynamic value) {
upgradeDto(value, "EmailNotificationsUpdate");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -254,6 +254,7 @@ class ExifResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ExifResponseDto? fromJson(dynamic value) {
upgradeDto(value, "ExifResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class FaceDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FaceDto? fromJson(dynamic value) {
upgradeDto(value, "FaceDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -69,6 +69,7 @@ class FacialRecognitionConfig {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FacialRecognitionConfig? fromJson(dynamic value) {
upgradeDto(value, "FacialRecognitionConfig");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class FileChecksumDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FileChecksumDto? fromJson(dynamic value) {
upgradeDto(value, "FileChecksumDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class FileChecksumResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FileChecksumResponseDto? fromJson(dynamic value) {
upgradeDto(value, "FileChecksumResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class FileReportDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FileReportDto? fromJson(dynamic value) {
upgradeDto(value, "FileReportDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class FileReportFixDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FileReportFixDto? fromJson(dynamic value) {
upgradeDto(value, "FileReportFixDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -74,6 +74,7 @@ class FileReportItemDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FileReportItemDto? fromJson(dynamic value) {
upgradeDto(value, "FileReportItemDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class FoldersResponse {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FoldersResponse? fromJson(dynamic value) {
upgradeDto(value, "FoldersResponse");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -66,6 +66,7 @@ class FoldersUpdate {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static FoldersUpdate? fromJson(dynamic value) {
upgradeDto(value, "FoldersUpdate");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class JobCommandDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static JobCommandDto? fromJson(dynamic value) {
upgradeDto(value, "JobCommandDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -70,6 +70,7 @@ class JobCountsDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static JobCountsDto? fromJson(dynamic value) {
upgradeDto(value, "JobCountsDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -40,6 +40,7 @@ class JobCreateDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static JobCreateDto? fromJson(dynamic value) {
upgradeDto(value, "JobCreateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -41,6 +41,7 @@ class JobSettingsDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static JobSettingsDto? fromJson(dynamic value) {
upgradeDto(value, "JobSettingsDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class JobStatusDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static JobStatusDto? fromJson(dynamic value) {
upgradeDto(value, "JobStatusDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -92,6 +92,7 @@ class LibraryResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static LibraryResponseDto? fromJson(dynamic value) {
upgradeDto(value, "LibraryResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -58,6 +58,7 @@ class LibraryStatsResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static LibraryStatsResponseDto? fromJson(dynamic value) {
upgradeDto(value, "LibraryStatsResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class LicenseKeyDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static LicenseKeyDto? fromJson(dynamic value) {
upgradeDto(value, "LicenseKeyDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -52,6 +52,7 @@ class LicenseResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static LicenseResponseDto? fromJson(dynamic value) {
upgradeDto(value, "LicenseResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class LoginCredentialDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static LoginCredentialDto? fromJson(dynamic value) {
upgradeDto(value, "LoginCredentialDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -76,6 +76,7 @@ class LoginResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static LoginResponseDto? fromJson(dynamic value) {
upgradeDto(value, "LoginResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -46,6 +46,7 @@ class LogoutResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static LogoutResponseDto? fromJson(dynamic value) {
upgradeDto(value, "LogoutResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -82,6 +82,7 @@ class MapMarkerResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static MapMarkerResponseDto? fromJson(dynamic value) {
upgradeDto(value, "MapMarkerResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -64,6 +64,7 @@ class MapReverseGeocodeResponseDto {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static MapReverseGeocodeResponseDto? fromJson(dynamic value) {
upgradeDto(value, "MapReverseGeocodeResponseDto");
if (value is Map) {
final json = value.cast<String, dynamic>();

View File

@@ -1,85 +0,0 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class MapTheme {
/// Instantiate a new enum with the provided [value].
const MapTheme._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const light = MapTheme._(r'light');
static const dark = MapTheme._(r'dark');
/// List of all possible values in this [enum][MapTheme].
static const values = <MapTheme>[
light,
dark,
];
static MapTheme? fromJson(dynamic value) => MapThemeTypeTransformer().decode(value);
static List<MapTheme> listFromJson(dynamic json, {bool growable = false,}) {
final result = <MapTheme>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = MapTheme.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [MapTheme] to String,
/// and [decode] dynamic data back to [MapTheme].
class MapThemeTypeTransformer {
factory MapThemeTypeTransformer() => _instance ??= const MapThemeTypeTransformer._();
const MapThemeTypeTransformer._();
String encode(MapTheme data) => data.value;
/// Decodes a [dynamic value][data] to a MapTheme.
///
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
MapTheme? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data) {
case r'light': return MapTheme.light;
case r'dark': return MapTheme.dark;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [MapThemeTypeTransformer] instance.
static MapThemeTypeTransformer? _instance;
}

View File

@@ -40,6 +40,7 @@ class MemoriesResponse {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static MemoriesResponse? fromJson(dynamic value) {
upgradeDto(value, "MemoriesResponse");
if (value is Map) {
final json = value.cast<String, dynamic>();

Some files were not shown because too many files have changed in this diff Show More