diff --git a/example/main.dart b/example/main.dart index 19266fa..977afd8 100644 --- a/example/main.dart +++ b/example/main.dart @@ -16,8 +16,9 @@ Future main() async { ))); // Generate image with barcode - final Uint8List generated = - await api.getBarcodeGenerate("QR", "text", textLocation: "None"); + final Uint8List generated = await api.getBarcodeGenerate( + EncodeBarcodeType.qR_.toString(), "text", + textLocation: "None"); // Save generated image to file File(fileName).writeAsBytesSync(generated); @@ -29,7 +30,7 @@ Future main() async { final BarcodeResponseList recognized = await api.postBarcodeRecognizeFromUrlOrContent( image: formFile, - preset: PresetType.highPerformance_.value, + preset: PresetType.highPerformance_.toString(), ); if (recognized.barcodes != null && recognized.barcodes!.isNotEmpty) { diff --git a/lib/src/api/barcode_api.dart b/lib/src/api/barcode_api.dart index 159b981..adceb8e 100644 --- a/lib/src/api/barcode_api.dart +++ b/lib/src/api/barcode_api.dart @@ -5,10 +5,12 @@ import 'package:http/http.dart' show MultipartFile, MultipartRequest; import '../../aspose_barcode_cloud.dart'; import '../api_helper.dart'; +/// BarcodeApi class BarcodeApi { - BarcodeApi(this.apiClient); + /// Constructor + BarcodeApi(this._apiClient); - final ApiClient apiClient; + final ApiClient _apiClient; /// /// Generate barcode. @@ -204,7 +206,7 @@ class BarcodeApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'GET', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { @@ -433,13 +435,13 @@ class BarcodeApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'GET', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'BarcodeResponseList') + return _apiClient.deserialize(response.body, 'BarcodeResponseList') as BarcodeResponseList; } } @@ -678,13 +680,20 @@ class BarcodeApi { } } else {} - final response = await apiClient.invokeAPI(requestPath, 'POST', queryParams, - postBody, headerParams, formParams, contentType, authNames); + final response = await _apiClient.invokeAPI( + requestPath, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentType, + authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'BarcodeResponseList') + return _apiClient.deserialize(response.body, 'BarcodeResponseList') as BarcodeResponseList; } } @@ -717,8 +726,15 @@ class BarcodeApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'POST', queryParams, - postBody, headerParams, formParams, contentType, authNames); + final response = await _apiClient.invokeAPI( + requestPath, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentType, + authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); @@ -938,13 +954,13 @@ class BarcodeApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'ResultImageInfo') + return _apiClient.deserialize(response.body, 'ResultImageInfo') as ResultImageInfo; } } @@ -986,13 +1002,13 @@ class BarcodeApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'BarcodeResponseList') + return _apiClient.deserialize(response.body, 'BarcodeResponseList') as BarcodeResponseList; } } @@ -1034,13 +1050,13 @@ class BarcodeApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'ResultImageInfo') + return _apiClient.deserialize(response.body, 'ResultImageInfo') as ResultImageInfo; } } diff --git a/lib/src/api/file_api.dart b/lib/src/api/file_api.dart index 9de4102..97b49d5 100644 --- a/lib/src/api/file_api.dart +++ b/lib/src/api/file_api.dart @@ -5,10 +5,12 @@ import 'package:http/http.dart' show MultipartFile, MultipartRequest; import '../../aspose_barcode_cloud.dart'; import '../api_helper.dart'; +/// FileApi class FileApi { - FileApi(this.apiClient); + /// Constructor + FileApi(this._apiClient); - final ApiClient apiClient; + final ApiClient _apiClient; /// /// Copy file @@ -50,7 +52,7 @@ class FileApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { @@ -92,7 +94,7 @@ class FileApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI( + final response = await _apiClient.invokeAPI( requestPath, 'DELETE', queryParams, @@ -141,7 +143,7 @@ class FileApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'GET', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { @@ -191,7 +193,7 @@ class FileApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { @@ -246,13 +248,13 @@ class FileApi { } } else {} - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'FilesUploadResult') + return _apiClient.deserialize(response.body, 'FilesUploadResult') as FilesUploadResult; } } diff --git a/lib/src/api/folder_api.dart b/lib/src/api/folder_api.dart index 2b8050f..ec9bd83 100644 --- a/lib/src/api/folder_api.dart +++ b/lib/src/api/folder_api.dart @@ -1,10 +1,12 @@ import '../../aspose_barcode_cloud.dart'; import '../api_helper.dart'; +/// FolderApi class FolderApi { - FolderApi(this.apiClient); + /// Constructor + FolderApi(this._apiClient); - final ApiClient apiClient; + final ApiClient _apiClient; /// /// Copy folder @@ -40,7 +42,7 @@ class FolderApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { @@ -77,7 +79,7 @@ class FolderApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { @@ -119,7 +121,7 @@ class FolderApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI( + final response = await _apiClient.invokeAPI( requestPath, 'DELETE', queryParams, @@ -163,13 +165,13 @@ class FolderApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'GET', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'FilesList') as FilesList; + return _apiClient.deserialize(response.body, 'FilesList') as FilesList; } } @@ -207,7 +209,7 @@ class FolderApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'PUT', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { diff --git a/lib/src/api/storage_api.dart b/lib/src/api/storage_api.dart index 92299b0..2350aa2 100644 --- a/lib/src/api/storage_api.dart +++ b/lib/src/api/storage_api.dart @@ -1,10 +1,12 @@ import '../../aspose_barcode_cloud.dart'; import '../api_helper.dart'; +/// StorageApi class StorageApi { - StorageApi(this.apiClient); + /// Constructor + StorageApi(this._apiClient); - final ApiClient apiClient; + final ApiClient _apiClient; /// /// Get disc usage @@ -32,13 +34,13 @@ class StorageApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'GET', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'DiscUsage') as DiscUsage; + return _apiClient.deserialize(response.body, 'DiscUsage') as DiscUsage; } } @@ -70,13 +72,13 @@ class StorageApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'GET', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'FileVersions') + return _apiClient.deserialize(response.body, 'FileVersions') as FileVersions; } } @@ -113,13 +115,14 @@ class StorageApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'GET', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'ObjectExist') as ObjectExist; + return _apiClient.deserialize(response.body, 'ObjectExist') + as ObjectExist; } } @@ -146,13 +149,13 @@ class StorageApi { contentTypes.isNotEmpty ? contentTypes[0] : "application/json"; final List authNames = ["JWT"]; - final response = await apiClient.invokeAPI(requestPath, 'GET', queryParams, + final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames); if (response.statusCode >= 400) { throw ApiException(response.statusCode, response.body); } else { - return apiClient.deserialize(response.body, 'StorageExist') + return _apiClient.deserialize(response.body, 'StorageExist') as StorageExist; } } diff --git a/lib/src/api_client.dart b/lib/src/api_client.dart index aedff09..2d2f6b2 100644 --- a/lib/src/api_client.dart +++ b/lib/src/api_client.dart @@ -8,14 +8,21 @@ import '../aspose_barcode_cloud.dart'; import 'api_helper.dart'; import 'auth/authentication.dart'; +/// Current SDK Version const SDK_VERSION = "1.24.2"; +/// ApiClient is responsible for making HTTP requests to the API. class ApiClient { - late final String basePath; - final httpClient = Http.Client(); + late final String _basePath; + final _httpClient = Http.Client(); + /// SDK header name static const String API_SDK_HEADER = "x-aspose-client"; + + /// SDK name static const String SDK_NAME = "dart sdk"; + + /// Aspose client version header name static const String API_CLIENT_VERSION_HEADER = "x-aspose-client-version"; final Map _defaultHeaderMap = { @@ -28,8 +35,9 @@ class ApiClient { final _regList = RegExp(r'^List<(.*)>$'); final _regMap = RegExp(r'^Map$'); + /// Constructor ApiClient(Configuration config) { - basePath = config.basePath; + _basePath = config.basePath; _authentication = OAuth( clientId: config.clientId, clientSecret: config.clientSecret, @@ -37,6 +45,7 @@ class ApiClient { tokenUrl: config.tokenUrl); } + /// Add default header value by key void addDefaultHeader(String key, String value) { _defaultHeaderMap[key] = value; } @@ -233,6 +242,7 @@ class ApiClient { 0, 'Could not find a suitable class for deserialization'); } + /// Deserialize the response into the target type. dynamic deserialize(String jsonVal, String targetType) { // Remove all spaces. Necessary for reg expressions as well. targetType = targetType.replaceAll(' ', ''); @@ -245,6 +255,7 @@ class ApiClient { return _deserialize(decodedJson, targetType); } + /// Serialize the object into a JSON string. String serialize(Object? obj) { String serialized = ''; if (obj == null) { @@ -255,8 +266,9 @@ class ApiClient { return serialized; } - // We don't use a Map for queryParams. - // If collectionFormat is 'multi' a key might appear multiple times. + /// Invoke HTTP request + /// We don't use a Map for queryParams. + /// If collectionFormat is 'multi' a key might appear multiple times. Future invokeAPI( String path, String method, @@ -271,7 +283,7 @@ class ApiClient { final ps = queryParams.map((p) => '${p.name}=${p.value}'); final String queryString = ps.isNotEmpty ? '?${ps.join('&')}' : ''; - final String url = basePath + path + queryString; + final String url = _basePath + path + queryString; headerParams.addAll(_defaultHeaderMap); headerParams['Content-Type'] = contentType; @@ -282,7 +294,7 @@ class ApiClient { request.files.addAll(body.files); request.headers.addAll(body.headers); request.headers.addAll(headerParams); - final response = await httpClient.send(request); + final response = await _httpClient.send(request); return Http.Response.fromStream(response); } else { final msgBody = contentType == "application/x-www-form-urlencoded" @@ -290,18 +302,18 @@ class ApiClient { : serialize(body); switch (method) { case "POST": - return httpClient.post(Uri.parse(url), + return _httpClient.post(Uri.parse(url), headers: headerParams, body: msgBody); case "PUT": - return httpClient.put(Uri.parse(url), + return _httpClient.put(Uri.parse(url), headers: headerParams, body: msgBody); case "DELETE": - return httpClient.delete(Uri.parse(url), headers: headerParams); + return _httpClient.delete(Uri.parse(url), headers: headerParams); case "PATCH": - return httpClient.patch(Uri.parse(url), + return _httpClient.patch(Uri.parse(url), headers: headerParams, body: msgBody); default: - return httpClient.get(Uri.parse(url), headers: headerParams); + return _httpClient.get(Uri.parse(url), headers: headerParams); } } } diff --git a/lib/src/api_exception.dart b/lib/src/api_exception.dart index a0c53e2..5dcc728 100644 --- a/lib/src/api_exception.dart +++ b/lib/src/api_exception.dart @@ -1,20 +1,26 @@ +/// Represents an exception that is thrown when an error occurs in the API. class ApiException implements Exception { - int code = 0; - String? message; + /// The error code. + final int code; + + /// The error message + final String message; + + /// The inner exception Exception? innerException; + + /// The stack trace StackTrace? stackTrace; + /// Constructor ApiException(this.code, this.message); + /// Constructor with inner exception ApiException.withInner( this.code, this.message, this.innerException, this.stackTrace); @override String toString() { - if (message == null) { - return "ApiException"; - } - if (innerException == null) { return "ApiException $code: $message"; } diff --git a/lib/src/api_helper.dart b/lib/src/api_helper.dart index fa6a2eb..b2c9a36 100644 --- a/lib/src/api_helper.dart +++ b/lib/src/api_helper.dart @@ -1,15 +1,18 @@ -import '../aspose_barcode_cloud.dart'; - const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +/// Represents a query parameter. class QueryParam { - String name; - String value; + /// The name of the parameter. + final String name; + + /// The value of the parameter. + final String value; + /// Constructor QueryParam(this.name, this.value); } -// port from Java version +/// port from Java version Iterable convertParametersForCollectionFormat( String collectionFormat, String name, dynamic value) { final params = []; @@ -47,84 +50,6 @@ String parameterToString(dynamic value) { return ''; } else if (value is DateTime) { return value.toUtc().toIso8601String(); - } else if (value is AutoSizeMode) { - return AutoSizeMode.encode(value).toString(); - } else if (value is AvailableGraphicsUnit) { - return AvailableGraphicsUnit.encode(value).toString(); - } else if (value is AztecEncodeMode) { - return AztecEncodeMode.encode(value).toString(); - } else if (value is AztecSymbolMode) { - return AztecSymbolMode.encode(value).toString(); - } else if (value is BorderDashStyle) { - return BorderDashStyle.encode(value).toString(); - } else if (value is ChecksumValidation) { - return ChecksumValidation.encode(value).toString(); - } else if (value is CodabarChecksumMode) { - return CodabarChecksumMode.encode(value).toString(); - } else if (value is CodabarSymbol) { - return CodabarSymbol.encode(value).toString(); - } else if (value is Code128Emulation) { - return Code128Emulation.encode(value).toString(); - } else if (value is Code128EncodeMode) { - return Code128EncodeMode.encode(value).toString(); - } else if (value is CodeLocation) { - return CodeLocation.encode(value).toString(); - } else if (value is CustomerInformationInterpretingType) { - return CustomerInformationInterpretingType.encode(value).toString(); - } else if (value is DataMatrixEccType) { - return DataMatrixEccType.encode(value).toString(); - } else if (value is DataMatrixEncodeMode) { - return DataMatrixEncodeMode.encode(value).toString(); - } else if (value is DataMatrixVersion) { - return DataMatrixVersion.encode(value).toString(); - } else if (value is DecodeBarcodeType) { - return DecodeBarcodeType.encode(value).toString(); - } else if (value is DotCodeEncodeMode) { - return DotCodeEncodeMode.encode(value).toString(); - } else if (value is ECIEncodings) { - return ECIEncodings.encode(value).toString(); - } else if (value is EnableChecksum) { - return EnableChecksum.encode(value).toString(); - } else if (value is EncodeBarcodeType) { - return EncodeBarcodeType.encode(value).toString(); - } else if (value is FontMode) { - return FontMode.encode(value).toString(); - } else if (value is FontStyle) { - return FontStyle.encode(value).toString(); - } else if (value is HanXinEncodeMode) { - return HanXinEncodeMode.encode(value).toString(); - } else if (value is HanXinErrorLevel) { - return HanXinErrorLevel.encode(value).toString(); - } else if (value is HanXinVersion) { - return HanXinVersion.encode(value).toString(); - } else if (value is ITF14BorderType) { - return ITF14BorderType.encode(value).toString(); - } else if (value is MacroCharacter) { - return MacroCharacter.encode(value).toString(); - } else if (value is MaxiCodeEncodeMode) { - return MaxiCodeEncodeMode.encode(value).toString(); - } else if (value is MaxiCodeMode) { - return MaxiCodeMode.encode(value).toString(); - } else if (value is PatchFormat) { - return PatchFormat.encode(value).toString(); - } else if (value is Pdf417CompactionMode) { - return Pdf417CompactionMode.encode(value).toString(); - } else if (value is Pdf417ErrorLevel) { - return Pdf417ErrorLevel.encode(value).toString(); - } else if (value is Pdf417MacroTerminator) { - return Pdf417MacroTerminator.encode(value).toString(); - } else if (value is PresetType) { - return PresetType.encode(value).toString(); - } else if (value is QREncodeMode) { - return QREncodeMode.encode(value).toString(); - } else if (value is QREncodeType) { - return QREncodeType.encode(value).toString(); - } else if (value is QRErrorLevel) { - return QRErrorLevel.encode(value).toString(); - } else if (value is QRVersion) { - return QRVersion.encode(value).toString(); - } else if (value is TextAlignment) { - return TextAlignment.encode(value).toString(); } else { return value.toString(); } diff --git a/lib/src/auth/authentication.dart b/lib/src/auth/authentication.dart index 1b7b3a2..bd816e5 100644 --- a/lib/src/auth/authentication.dart +++ b/lib/src/auth/authentication.dart @@ -1,5 +1,9 @@ import '../api_helper.dart'; +/// The base class for all authentications. +/// +/// To use this class, extend it and implement the `applyToParams` method. +/// This method will be called before every HTTP request to apply the authentication settings. abstract class Authentication { /// Apply authentication settings to header and query params. Future applyToParams( diff --git a/lib/src/auth/oauth.dart b/lib/src/auth/oauth.dart index 34d9503..1272866 100644 --- a/lib/src/auth/oauth.dart +++ b/lib/src/auth/oauth.dart @@ -6,13 +6,24 @@ import '../api_exception.dart'; import '../api_helper.dart'; import 'authentication.dart'; +/// OAuth 2.0 authentication class OAuth implements Authentication { - String? clientId; - String? clientSecret; - String tokenUrl; + /// Client Id from https://dashboard.aspose.cloud/applications + final String? clientId; + + /// Client Secret from https://dashboard.aspose.cloud/applications + final String? clientSecret; + + /// URL to get the token + final String tokenUrl; + + /// Access token value String? accessToken; + + /// Token expiration date DateTime? tokenExpiration; + /// Constructor OAuth( {this.clientId, this.clientSecret, @@ -41,6 +52,7 @@ class OAuth implements Authentication { headerParams["Authorization"] = "Bearer ${accessToken!}"; } + /// Fetches the token from the OAuth server Future fetchToken() async { final request = MultipartRequest('POST', Uri.parse(tokenUrl)) ..fields['grant_type'] = 'client_credentials' diff --git a/lib/src/configuration.dart b/lib/src/configuration.dart index 631bd84..b59af57 100644 --- a/lib/src/configuration.dart +++ b/lib/src/configuration.dart @@ -3,17 +3,30 @@ import 'dart:convert' show JsonEncoder, jsonDecode; import 'dart:io'; +/// Default token url const DEFAULT_TOKEN_URL = "https://api.aspose.cloud/connect/token"; + +/// Default API base path const DEFAULT_BASE_PATH = "https://api.aspose.cloud/v3.0"; -// Configuration for ApiClient +/// Configuration for ApiClient class Configuration { + /// Client Id from https://dashboard.aspose.cloud/applications final String? clientId; + + /// Client Secret from https://dashboard.aspose.cloud/applications final String? clientSecret; + + /// Access token final String? accessToken; + + /// Token url late final String tokenUrl; + + /// Base API path late final String basePath; + /// Constructor Configuration({ this.clientId, this.clientSecret, @@ -25,7 +38,7 @@ class Configuration { this.tokenUrl = tokenUrl ?? DEFAULT_TOKEN_URL; } - static Configuration fromJson(Map json) { + static Configuration _fromJson(Map json) { return Configuration( clientId: json['clientId'], clientSecret: json['clientSecret'], @@ -35,7 +48,7 @@ class Configuration { ); } - Map toJson() => { + Map _toJson() => { if (clientId != null) 'clientId': clientId, if (clientSecret != null) 'clientSecret': clientSecret, 'basePath': basePath, @@ -43,22 +56,25 @@ class Configuration { if (accessToken != null) 'accessToken': accessToken, }; + /// Save configuration to file Future save(String fileName) async { final file = File(fileName); final encoder = JsonEncoder.withIndent(' '); - final jsonString = encoder.convert(toJson()); + final jsonString = encoder.convert(_toJson()); await file.writeAsString(jsonString); } + /// Load configuration from file static Configuration? load(String fileName) { final file = File(fileName); if (!file.existsSync()) { return null; } final Map jsonMap = jsonDecode(file.readAsStringSync()); - return Configuration.fromJson(jsonMap); + return Configuration._fromJson(jsonMap); } + /// Load configuration from environment variables static fromEnv({String prefix = ""}) { final accessToken = Platform.environment["${prefix}ACCESS_TOKEN"]; return Configuration( diff --git a/lib/src/model/api_error.dart b/lib/src/model/api_error.dart index 58cfcdf..f5b13ee 100644 --- a/lib/src/model/api_error.dart +++ b/lib/src/model/api_error.dart @@ -1,17 +1,24 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// ApiError class ApiError { + /// code String? code; + /// message String? message; + /// description String? description; + /// dateTime DateTime? dateTime; + /// innerError ApiError? innerError; + /// Constructor ApiError(); @override @@ -19,6 +26,7 @@ class ApiError { return 'ApiError[code=$code, message=$message, description=$description, dateTime=$dateTime, innerError=$innerError, ]'; } + /// Creates a ApiError instance from a JSON representation. ApiError.fromJson(Map json) { code = json['code']; message = json['message']; @@ -28,6 +36,7 @@ class ApiError { innerError = ApiError.fromJson(json['innerError']); } + /// Returns a JSON representation of ApiError. Map toJson() { return { 'Code': code, @@ -38,17 +47,11 @@ class ApiError { }; } + /// Converts a list of JSON objects to a list of ApiError instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ApiError instances. static List listFromJson(List json) { return json.map((value) => ApiError.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = ApiError.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/api_error_response.dart b/lib/src/model/api_error_response.dart index 23e7752..6abe8aa 100644 --- a/lib/src/model/api_error_response.dart +++ b/lib/src/model/api_error_response.dart @@ -2,11 +2,15 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// ApiErrorResponse class ApiErrorResponse { + /// requestId String? requestId; + /// error ApiError? error; + /// Constructor ApiErrorResponse(); @override @@ -14,26 +18,22 @@ class ApiErrorResponse { return 'ApiErrorResponse[requestId=$requestId, error=$error, ]'; } + /// Creates a ApiErrorResponse instance from a JSON representation. ApiErrorResponse.fromJson(Map json) { requestId = json['requestId']; error = ApiError.fromJson(json['error']); } + /// Returns a JSON representation of ApiErrorResponse. Map toJson() { return {'RequestId': requestId, 'Error': error}; } + /// Converts a list of JSON objects to a list of ApiErrorResponse instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ApiErrorResponse instances. static List listFromJson(List json) { return json.map((value) => ApiErrorResponse.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = ApiErrorResponse.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/australian_post_params.dart b/lib/src/model/australian_post_params.dart index 7af4953..cbf8b89 100644 --- a/lib/src/model/australian_post_params.dart +++ b/lib/src/model/australian_post_params.dart @@ -2,13 +2,15 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// AustralianPost barcode parameters. class AustralianPostParams { - /* Interpreting type for the Customer Information of AustralianPost, default to CustomerInformationInterpretingType.Other\" */ + /// Interpreting type for the Customer Information of AustralianPost, default to CustomerInformationInterpretingType.Other\" CustomerInformationInterpretingType? encodingTable; -/* Short bar's height of AustralianPost barcode. */ + /// Short bar's height of AustralianPost barcode. double? shortBarHeight; + /// Constructor AustralianPostParams(); @override @@ -16,27 +18,23 @@ class AustralianPostParams { return 'AustralianPostParams[encodingTable=$encodingTable, shortBarHeight=$shortBarHeight, ]'; } + /// Creates a AustralianPostParams instance from a JSON representation. AustralianPostParams.fromJson(Map json) { encodingTable = CustomerInformationInterpretingType.fromJson(json['encodingTable']); shortBarHeight = json['shortBarHeight']?.toDouble(); } + /// Returns a JSON representation of AustralianPostParams. Map toJson() { return {'EncodingTable': encodingTable, 'ShortBarHeight': shortBarHeight}; } + /// Converts a list of JSON objects to a list of AustralianPostParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of AustralianPostParams instances. static List listFromJson(List json) { return json.map((value) => AustralianPostParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = AustralianPostParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/auto_size_mode.dart b/lib/src/model/auto_size_mode.dart index 597dfce..02dd669 100644 --- a/lib/src/model/auto_size_mode.dart +++ b/lib/src/model/auto_size_mode.dart @@ -1,8 +1,10 @@ +/// +/// AutoSizeMode: [None, Nearest, Interpolation] class AutoSizeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of AutoSizeMode enum. + late final String _value; - AutoSizeMode._internal(this.value); + AutoSizeMode._internal(this._value); /// static AutoSizeMode none_ = AutoSizeMode._internal("None"); @@ -13,35 +15,33 @@ class AutoSizeMode { /// static AutoSizeMode interpolation_ = AutoSizeMode._internal("Interpolation"); + /// Creates a AutoSizeMode instance from a JSON representation. AutoSizeMode.fromJson(dynamic data) { switch (data) { case "None": - value = data; - break; case "Nearest": - value = data; - break; case "Interpolation": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(AutoSizeMode data) { - return data.value; - } - + /// Returns a JSON representation of AutoSizeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of AutoSizeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of AutoSizeMode instances. static List listFromJson(List json) { return json.map((value) => AutoSizeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/available_graphics_unit.dart b/lib/src/model/available_graphics_unit.dart index f1950d2..03f7a4c 100644 --- a/lib/src/model/available_graphics_unit.dart +++ b/lib/src/model/available_graphics_unit.dart @@ -1,8 +1,10 @@ +/// Subset of GraphicsUnit. +/// AvailableGraphicsUnit: [Pixel, Point, Inch, Millimeter] class AvailableGraphicsUnit { - /// The underlying value of this enum member. - String? value; + /// The underlying value of AvailableGraphicsUnit enum. + late final String _value; - AvailableGraphicsUnit._internal(this.value); + AvailableGraphicsUnit._internal(this._value); /// Subset of GraphicsUnit. static AvailableGraphicsUnit pixel_ = @@ -19,38 +21,34 @@ class AvailableGraphicsUnit { static AvailableGraphicsUnit millimeter_ = AvailableGraphicsUnit._internal("Millimeter"); + /// Creates a AvailableGraphicsUnit instance from a JSON representation. AvailableGraphicsUnit.fromJson(dynamic data) { switch (data) { case "Pixel": - value = data; - break; case "Point": - value = data; - break; case "Inch": - value = data; - break; case "Millimeter": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(AvailableGraphicsUnit data) { - return data.value; - } - + /// Returns a JSON representation of AvailableGraphicsUnit. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of AvailableGraphicsUnit instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of AvailableGraphicsUnit instances. static List listFromJson(List json) { return json.map((value) => AvailableGraphicsUnit.fromJson(value)).toList(); } diff --git a/lib/src/model/aztec_encode_mode.dart b/lib/src/model/aztec_encode_mode.dart index ba30df0..6bbd943 100644 --- a/lib/src/model/aztec_encode_mode.dart +++ b/lib/src/model/aztec_encode_mode.dart @@ -1,8 +1,10 @@ +/// +/// AztecEncodeMode: [Auto, Bytes, ExtendedCodetext] class AztecEncodeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of AztecEncodeMode enum. + late final String _value; - AztecEncodeMode._internal(this.value); + AztecEncodeMode._internal(this._value); /// static AztecEncodeMode auto_ = AztecEncodeMode._internal("Auto"); @@ -14,35 +16,33 @@ class AztecEncodeMode { static AztecEncodeMode extendedCodetext_ = AztecEncodeMode._internal("ExtendedCodetext"); + /// Creates a AztecEncodeMode instance from a JSON representation. AztecEncodeMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Bytes": - value = data; - break; case "ExtendedCodetext": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(AztecEncodeMode data) { - return data.value; - } - + /// Returns a JSON representation of AztecEncodeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of AztecEncodeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of AztecEncodeMode instances. static List listFromJson(List json) { return json.map((value) => AztecEncodeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/aztec_params.dart b/lib/src/model/aztec_params.dart index a8f927d..94442f0 100644 --- a/lib/src/model/aztec_params.dart +++ b/lib/src/model/aztec_params.dart @@ -2,33 +2,33 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Aztec parameters. class AztecParams { - /* Height/Width ratio of 2D BarCode module. */ + /// Height/Width ratio of 2D BarCode module. double? aspectRatio; -/* Level of error correction of Aztec types of barcode. Value should between 10 to 95. */ + /// Level of error correction of Aztec types of barcode. Value should between 10 to 95. int? errorLevel; -/* Aztec Symbol mode. Default value: AztecSymbolMode.Auto. */ + /// Aztec Symbol mode. Default value: AztecSymbolMode.Auto. AztecSymbolMode? symbolMode; -/* DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. */ - @Deprecated( - "This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. ") + /// DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. String? textEncoding; -/* Encoding mode for Aztec barcodes. Default value: Auto */ + /// Encoding mode for Aztec barcodes. Default value: Auto AztecEncodeMode? encodeMode; -/* Identifies ECI encoding. Used when AztecEncodeMode is Auto. Default value: ISO-8859-1. */ + /// Identifies ECI encoding. Used when AztecEncodeMode is Auto. Default value: ISO-8859-1. ECIEncodings? eCIEncoding; -/* Used to instruct the reader to interpret the data contained within the symbol as programming for reader initialization. */ + /// Used to instruct the reader to interpret the data contained within the symbol as programming for reader initialization. bool? isReaderInitialization; -/* Gets or sets layers count of Aztec symbol. Layers count should be in range from 1 to 3 for Compact mode and in range from 1 to 32 for Full Range mode. Default value: 0 (auto). */ + /// Gets or sets layers count of Aztec symbol. Layers count should be in range from 1 to 3 for Compact mode and in range from 1 to 32 for Full Range mode. Default value: 0 (auto). int? layersCount; + /// Constructor AztecParams(); @override @@ -36,6 +36,7 @@ class AztecParams { return 'AztecParams[aspectRatio=$aspectRatio, errorLevel=$errorLevel, symbolMode=$symbolMode, textEncoding=$textEncoding, encodeMode=$encodeMode, eCIEncoding=$eCIEncoding, isReaderInitialization=$isReaderInitialization, layersCount=$layersCount, ]'; } + /// Creates a AztecParams instance from a JSON representation. AztecParams.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); errorLevel = json['errorLevel']; @@ -47,6 +48,7 @@ class AztecParams { layersCount = json['layersCount']; } + /// Returns a JSON representation of AztecParams. Map toJson() { return { 'AspectRatio': aspectRatio, @@ -60,17 +62,11 @@ class AztecParams { }; } + /// Converts a list of JSON objects to a list of AztecParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of AztecParams instances. static List listFromJson(List json) { return json.map((value) => AztecParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = AztecParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/aztec_symbol_mode.dart b/lib/src/model/aztec_symbol_mode.dart index e0b2a27..f200b4e 100644 --- a/lib/src/model/aztec_symbol_mode.dart +++ b/lib/src/model/aztec_symbol_mode.dart @@ -1,8 +1,10 @@ +/// +/// AztecSymbolMode: [Auto, Compact, FullRange, Rune] class AztecSymbolMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of AztecSymbolMode enum. + late final String _value; - AztecSymbolMode._internal(this.value); + AztecSymbolMode._internal(this._value); /// static AztecSymbolMode auto_ = AztecSymbolMode._internal("Auto"); @@ -16,38 +18,34 @@ class AztecSymbolMode { /// static AztecSymbolMode rune_ = AztecSymbolMode._internal("Rune"); + /// Creates a AztecSymbolMode instance from a JSON representation. AztecSymbolMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Compact": - value = data; - break; case "FullRange": - value = data; - break; case "Rune": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(AztecSymbolMode data) { - return data.value; - } - + /// Returns a JSON representation of AztecSymbolMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of AztecSymbolMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of AztecSymbolMode instances. static List listFromJson(List json) { return json.map((value) => AztecSymbolMode.fromJson(value)).toList(); } diff --git a/lib/src/model/barcode_response.dart b/lib/src/model/barcode_response.dart index 69f4ea9..c24754c 100644 --- a/lib/src/model/barcode_response.dart +++ b/lib/src/model/barcode_response.dart @@ -2,19 +2,21 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Represents information about barcode. class BarcodeResponse { - /* Barcode data. */ + /// Barcode data. String? barcodeValue; -/* Type of the barcode. */ + /// Type of the barcode. String? type; -/* Region with barcode. */ + /// Region with barcode. List? region = []; -/* Checksum of barcode. */ + /// Checksum of barcode. String? checksum; + /// Constructor BarcodeResponse(); @override @@ -22,6 +24,7 @@ class BarcodeResponse { return 'BarcodeResponse[barcodeValue=$barcodeValue, type=$type, region=$region, checksum=$checksum, ]'; } + /// Creates a BarcodeResponse instance from a JSON representation. BarcodeResponse.fromJson(Map json) { barcodeValue = json['barcodeValue']; type = json['type']; @@ -29,6 +32,7 @@ class BarcodeResponse { checksum = json['checksum']; } + /// Returns a JSON representation of BarcodeResponse. Map toJson() { return { 'BarcodeValue': barcodeValue, @@ -38,17 +42,11 @@ class BarcodeResponse { }; } + /// Converts a list of JSON objects to a list of BarcodeResponse instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of BarcodeResponse instances. static List listFromJson(List json) { return json.map((value) => BarcodeResponse.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = BarcodeResponse.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/barcode_response_list.dart b/lib/src/model/barcode_response_list.dart index e85eef5..bee3544 100644 --- a/lib/src/model/barcode_response_list.dart +++ b/lib/src/model/barcode_response_list.dart @@ -2,10 +2,12 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Represents information about barcode list. class BarcodeResponseList { - /* List of barcodes which are present in image. */ + /// List of barcodes which are present in image. List? barcodes = []; + /// Constructor BarcodeResponseList(); @override @@ -13,25 +15,21 @@ class BarcodeResponseList { return 'BarcodeResponseList[barcodes=$barcodes, ]'; } + /// Creates a BarcodeResponseList instance from a JSON representation. BarcodeResponseList.fromJson(Map json) { barcodes = BarcodeResponse.listFromJson(json['barcodes']); } + /// Returns a JSON representation of BarcodeResponseList. Map toJson() { return {'Barcodes': barcodes}; } + /// Converts a list of JSON objects to a list of BarcodeResponseList instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of BarcodeResponseList instances. static List listFromJson(List json) { return json.map((value) => BarcodeResponseList.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = BarcodeResponseList.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/border_dash_style.dart b/lib/src/model/border_dash_style.dart index 4194d9e..f05f878 100644 --- a/lib/src/model/border_dash_style.dart +++ b/lib/src/model/border_dash_style.dart @@ -1,8 +1,10 @@ +/// +/// BorderDashStyle: [Solid, Dash, Dot, DashDot, DashDotDot] class BorderDashStyle { - /// The underlying value of this enum member. - String? value; + /// The underlying value of BorderDashStyle enum. + late final String _value; - BorderDashStyle._internal(this.value); + BorderDashStyle._internal(this._value); /// static BorderDashStyle solid_ = BorderDashStyle._internal("Solid"); @@ -19,41 +21,35 @@ class BorderDashStyle { /// static BorderDashStyle dashDotDot_ = BorderDashStyle._internal("DashDotDot"); + /// Creates a BorderDashStyle instance from a JSON representation. BorderDashStyle.fromJson(dynamic data) { switch (data) { case "Solid": - value = data; - break; case "Dash": - value = data; - break; case "Dot": - value = data; - break; case "DashDot": - value = data; - break; case "DashDotDot": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(BorderDashStyle data) { - return data.value; - } - + /// Returns a JSON representation of BorderDashStyle. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of BorderDashStyle instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of BorderDashStyle instances. static List listFromJson(List json) { return json.map((value) => BorderDashStyle.fromJson(value)).toList(); } diff --git a/lib/src/model/caption_params.dart b/lib/src/model/caption_params.dart index 4987589..72afe19 100644 --- a/lib/src/model/caption_params.dart +++ b/lib/src/model/caption_params.dart @@ -2,28 +2,30 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Caption class CaptionParams { - /* Caption text. */ + /// Caption text. String? text; -/* Text alignment. */ + /// Text alignment. TextAlignment? alignment; -/* Text color. */ + /// Text color. String? color; -/* Is caption visible. */ + /// Is caption visible. bool? visible; -/* Font. */ + /// Font. FontParams? font; -/* Padding. */ + /// Padding. Padding? padding; -/* Specify word wraps (line breaks) within text. Default value: false. */ + /// Specify word wraps (line breaks) within text. Default value: false. bool? noWrap; + /// Constructor CaptionParams(); @override @@ -31,6 +33,7 @@ class CaptionParams { return 'CaptionParams[text=$text, alignment=$alignment, color=$color, visible=$visible, font=$font, padding=$padding, noWrap=$noWrap, ]'; } + /// Creates a CaptionParams instance from a JSON representation. CaptionParams.fromJson(Map json) { text = json['text']; alignment = TextAlignment.fromJson(json['alignment']); @@ -41,6 +44,7 @@ class CaptionParams { noWrap = json['noWrap']; } + /// Returns a JSON representation of CaptionParams. Map toJson() { return { 'Text': text, @@ -53,17 +57,11 @@ class CaptionParams { }; } + /// Converts a list of JSON objects to a list of CaptionParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of CaptionParams instances. static List listFromJson(List json) { return json.map((value) => CaptionParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = CaptionParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/checksum_validation.dart b/lib/src/model/checksum_validation.dart index 8fe08cd..cdd8d2a 100644 --- a/lib/src/model/checksum_validation.dart +++ b/lib/src/model/checksum_validation.dart @@ -1,8 +1,10 @@ +/// +/// ChecksumValidation: [Default, On, Off] class ChecksumValidation { - /// The underlying value of this enum member. - String? value; + /// The underlying value of ChecksumValidation enum. + late final String _value; - ChecksumValidation._internal(this.value); + ChecksumValidation._internal(this._value); /// static ChecksumValidation default_ = ChecksumValidation._internal("Default"); @@ -13,35 +15,33 @@ class ChecksumValidation { /// static ChecksumValidation off_ = ChecksumValidation._internal("Off"); + /// Creates a ChecksumValidation instance from a JSON representation. ChecksumValidation.fromJson(dynamic data) { switch (data) { case "Default": - value = data; - break; case "On": - value = data; - break; case "Off": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(ChecksumValidation data) { - return data.value; - } - + /// Returns a JSON representation of ChecksumValidation. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of ChecksumValidation instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ChecksumValidation instances. static List listFromJson(List json) { return json.map((value) => ChecksumValidation.fromJson(value)).toList(); } diff --git a/lib/src/model/codabar_checksum_mode.dart b/lib/src/model/codabar_checksum_mode.dart index f0e5339..81b3054 100644 --- a/lib/src/model/codabar_checksum_mode.dart +++ b/lib/src/model/codabar_checksum_mode.dart @@ -1,8 +1,10 @@ +/// +/// CodabarChecksumMode: [Mod10, Mod16] class CodabarChecksumMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of CodabarChecksumMode enum. + late final String _value; - CodabarChecksumMode._internal(this.value); + CodabarChecksumMode._internal(this._value); /// static CodabarChecksumMode mod10_ = CodabarChecksumMode._internal("Mod10"); @@ -10,32 +12,32 @@ class CodabarChecksumMode { /// static CodabarChecksumMode mod16_ = CodabarChecksumMode._internal("Mod16"); + /// Creates a CodabarChecksumMode instance from a JSON representation. CodabarChecksumMode.fromJson(dynamic data) { switch (data) { case "Mod10": - value = data; - break; case "Mod16": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(CodabarChecksumMode data) { - return data.value; - } - + /// Returns a JSON representation of CodabarChecksumMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of CodabarChecksumMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of CodabarChecksumMode instances. static List listFromJson(List json) { return json.map((value) => CodabarChecksumMode.fromJson(value)).toList(); } diff --git a/lib/src/model/codabar_params.dart b/lib/src/model/codabar_params.dart index cf5ce5e..bdf1837 100644 --- a/lib/src/model/codabar_params.dart +++ b/lib/src/model/codabar_params.dart @@ -2,16 +2,18 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Codabar parameters. class CodabarParams { - /* Checksum algorithm for Codabar barcodes. Default value: CodabarChecksumMode.Mod16. To enable checksum calculation set value EnableChecksum.Yes to property EnableChecksum. */ + /// Checksum algorithm for Codabar barcodes. Default value: CodabarChecksumMode.Mod16. To enable checksum calculation set value EnableChecksum.Yes to property EnableChecksum. CodabarChecksumMode? checksumMode; -/* Start symbol (character) of Codabar symbology. Default value: CodabarSymbol.A */ + /// Start symbol (character) of Codabar symbology. Default value: CodabarSymbol.A CodabarSymbol? startSymbol; -/* Stop symbol (character) of Codabar symbology. Default value: CodabarSymbol.A */ + /// Stop symbol (character) of Codabar symbology. Default value: CodabarSymbol.A CodabarSymbol? stopSymbol; + /// Constructor CodabarParams(); @override @@ -19,12 +21,14 @@ class CodabarParams { return 'CodabarParams[checksumMode=$checksumMode, startSymbol=$startSymbol, stopSymbol=$stopSymbol, ]'; } + /// Creates a CodabarParams instance from a JSON representation. CodabarParams.fromJson(Map json) { checksumMode = CodabarChecksumMode.fromJson(json['checksumMode']); startSymbol = CodabarSymbol.fromJson(json['startSymbol']); stopSymbol = CodabarSymbol.fromJson(json['stopSymbol']); } + /// Returns a JSON representation of CodabarParams. Map toJson() { return { 'ChecksumMode': checksumMode, @@ -33,17 +37,11 @@ class CodabarParams { }; } + /// Converts a list of JSON objects to a list of CodabarParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of CodabarParams instances. static List listFromJson(List json) { return json.map((value) => CodabarParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = CodabarParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/codabar_symbol.dart b/lib/src/model/codabar_symbol.dart index 1d03a91..88bb47e 100644 --- a/lib/src/model/codabar_symbol.dart +++ b/lib/src/model/codabar_symbol.dart @@ -1,8 +1,10 @@ +/// +/// CodabarSymbol: [A, B, C, D] class CodabarSymbol { - /// The underlying value of this enum member. - String? value; + /// The underlying value of CodabarSymbol enum. + late final String _value; - CodabarSymbol._internal(this.value); + CodabarSymbol._internal(this._value); /// static CodabarSymbol a_ = CodabarSymbol._internal("A"); @@ -16,38 +18,34 @@ class CodabarSymbol { /// static CodabarSymbol d_ = CodabarSymbol._internal("D"); + /// Creates a CodabarSymbol instance from a JSON representation. CodabarSymbol.fromJson(dynamic data) { switch (data) { case "A": - value = data; - break; case "B": - value = data; - break; case "C": - value = data; - break; case "D": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(CodabarSymbol data) { - return data.value; - } - + /// Returns a JSON representation of CodabarSymbol. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of CodabarSymbol instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of CodabarSymbol instances. static List listFromJson(List json) { return json.map((value) => CodabarSymbol.fromJson(value)).toList(); } diff --git a/lib/src/model/codablock_params.dart b/lib/src/model/codablock_params.dart index e971bf2..d48ba9c 100644 --- a/lib/src/model/codablock_params.dart +++ b/lib/src/model/codablock_params.dart @@ -1,16 +1,18 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Codablock parameters. class CodablockParams { - /* Height/Width ratio of 2D BarCode module. */ + /// Height/Width ratio of 2D BarCode module. double? aspectRatio; -/* Columns count. */ + /// Columns count. int? columns; -/* Rows count. */ + /// Rows count. int? rows; + /// Constructor CodablockParams(); @override @@ -18,27 +20,23 @@ class CodablockParams { return 'CodablockParams[aspectRatio=$aspectRatio, columns=$columns, rows=$rows, ]'; } + /// Creates a CodablockParams instance from a JSON representation. CodablockParams.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); columns = json['columns']; rows = json['rows']; } + /// Returns a JSON representation of CodablockParams. Map toJson() { return {'AspectRatio': aspectRatio, 'Columns': columns, 'Rows': rows}; } + /// Converts a list of JSON objects to a list of CodablockParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of CodablockParams instances. static List listFromJson(List json) { return json.map((value) => CodablockParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = CodablockParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/code128_emulation.dart b/lib/src/model/code128_emulation.dart index 79ee791..7c9d6b1 100644 --- a/lib/src/model/code128_emulation.dart +++ b/lib/src/model/code128_emulation.dart @@ -1,8 +1,10 @@ +/// DEPRECATED. This enum will be removed in future releases Function codewords for Code 128 emulation. Applied for MicroPDF417 only. Ignored for PDF417 and MacroPDF417 barcodes. +/// Code128Emulation: [None, Code903, Code904, Code905] class Code128Emulation { - /// The underlying value of this enum member. - String? value; + /// The underlying value of Code128Emulation enum. + late final String _value; - Code128Emulation._internal(this.value); + Code128Emulation._internal(this._value); /// DEPRECATED. This enum will be removed in future releases Function codewords for Code 128 emulation. Applied for MicroPDF417 only. Ignored for PDF417 and MacroPDF417 barcodes. static Code128Emulation none_ = Code128Emulation._internal("None"); @@ -16,38 +18,34 @@ class Code128Emulation { /// DEPRECATED. This enum will be removed in future releases Function codewords for Code 128 emulation. Applied for MicroPDF417 only. Ignored for PDF417 and MacroPDF417 barcodes. static Code128Emulation code905_ = Code128Emulation._internal("Code905"); + /// Creates a Code128Emulation instance from a JSON representation. Code128Emulation.fromJson(dynamic data) { switch (data) { case "None": - value = data; - break; case "Code903": - value = data; - break; case "Code904": - value = data; - break; case "Code905": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(Code128Emulation data) { - return data.value; - } - + /// Returns a JSON representation of Code128Emulation. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of Code128Emulation instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Code128Emulation instances. static List listFromJson(List json) { return json.map((value) => Code128Emulation.fromJson(value)).toList(); } diff --git a/lib/src/model/code128_encode_mode.dart b/lib/src/model/code128_encode_mode.dart index 926a392..7de1d98 100644 --- a/lib/src/model/code128_encode_mode.dart +++ b/lib/src/model/code128_encode_mode.dart @@ -1,8 +1,10 @@ +/// +/// Code128EncodeMode: [Auto, CodeA, CodeB, CodeAB, CodeC, CodeAC, CodeBC] class Code128EncodeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of Code128EncodeMode enum. + late final String _value; - Code128EncodeMode._internal(this.value); + Code128EncodeMode._internal(this._value); /// static Code128EncodeMode auto_ = Code128EncodeMode._internal("Auto"); @@ -25,47 +27,37 @@ class Code128EncodeMode { /// static Code128EncodeMode codeBC_ = Code128EncodeMode._internal("CodeBC"); + /// Creates a Code128EncodeMode instance from a JSON representation. Code128EncodeMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "CodeA": - value = data; - break; case "CodeB": - value = data; - break; case "CodeAB": - value = data; - break; case "CodeC": - value = data; - break; case "CodeAC": - value = data; - break; case "CodeBC": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(Code128EncodeMode data) { - return data.value; - } - + /// Returns a JSON representation of Code128EncodeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of Code128EncodeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Code128EncodeMode instances. static List listFromJson(List json) { return json.map((value) => Code128EncodeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/code128_params.dart b/lib/src/model/code128_params.dart index 81c151c..37c376e 100644 --- a/lib/src/model/code128_params.dart +++ b/lib/src/model/code128_params.dart @@ -2,10 +2,12 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Code128 params. class Code128Params { - /* Encoding mode for Code128 barcodes. Code 128 specification Default value: Code128EncodeMode.Auto. */ + /// Encoding mode for Code128 barcodes. Code 128 specification Default value: Code128EncodeMode.Auto. Code128EncodeMode? encodeMode; + /// Constructor Code128Params(); @override @@ -13,25 +15,21 @@ class Code128Params { return 'Code128Params[encodeMode=$encodeMode, ]'; } + /// Creates a Code128Params instance from a JSON representation. Code128Params.fromJson(Map json) { encodeMode = Code128EncodeMode.fromJson(json['encodeMode']); } + /// Returns a JSON representation of Code128Params. Map toJson() { return {'EncodeMode': encodeMode}; } + /// Converts a list of JSON objects to a list of Code128Params instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Code128Params instances. static List listFromJson(List json) { return json.map((value) => Code128Params.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = Code128Params.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/code16_k_params.dart b/lib/src/model/code16_k_params.dart index e7febb6..5d89274 100644 --- a/lib/src/model/code16_k_params.dart +++ b/lib/src/model/code16_k_params.dart @@ -1,16 +1,18 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Code16K parameters. class Code16KParams { - /* Height/Width ratio of 2D BarCode module. */ + /// Height/Width ratio of 2D BarCode module. double? aspectRatio; -/* Size of the left quiet zone in xDimension. Default value: 10, meaning if xDimension = 2px than left quiet zone will be 20px. */ + /// Size of the left quiet zone in xDimension. Default value: 10, meaning if xDimension = 2px than left quiet zone will be 20px. int? quietZoneLeftCoef; -/* Size of the right quiet zone in xDimension. Default value: 1, meaning if xDimension = 2px than right quiet zone will be 2px. */ + /// Size of the right quiet zone in xDimension. Default value: 1, meaning if xDimension = 2px than right quiet zone will be 2px. int? quietZoneRightCoef; + /// Constructor Code16KParams(); @override @@ -18,12 +20,14 @@ class Code16KParams { return 'Code16KParams[aspectRatio=$aspectRatio, quietZoneLeftCoef=$quietZoneLeftCoef, quietZoneRightCoef=$quietZoneRightCoef, ]'; } + /// Creates a Code16KParams instance from a JSON representation. Code16KParams.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); quietZoneLeftCoef = json['quietZoneLeftCoef']; quietZoneRightCoef = json['quietZoneRightCoef']; } + /// Returns a JSON representation of Code16KParams. Map toJson() { return { 'AspectRatio': aspectRatio, @@ -32,17 +36,11 @@ class Code16KParams { }; } + /// Converts a list of JSON objects to a list of Code16KParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Code16KParams instances. static List listFromJson(List json) { return json.map((value) => Code16KParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = Code16KParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/code_location.dart b/lib/src/model/code_location.dart index 38e6416..d805106 100644 --- a/lib/src/model/code_location.dart +++ b/lib/src/model/code_location.dart @@ -1,8 +1,10 @@ +/// +/// CodeLocation: [Below, Above, None] class CodeLocation { - /// The underlying value of this enum member. - String? value; + /// The underlying value of CodeLocation enum. + late final String _value; - CodeLocation._internal(this.value); + CodeLocation._internal(this._value); /// static CodeLocation below_ = CodeLocation._internal("Below"); @@ -13,35 +15,33 @@ class CodeLocation { /// static CodeLocation none_ = CodeLocation._internal("None"); + /// Creates a CodeLocation instance from a JSON representation. CodeLocation.fromJson(dynamic data) { switch (data) { case "Below": - value = data; - break; case "Above": - value = data; - break; case "None": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(CodeLocation data) { - return data.value; - } - + /// Returns a JSON representation of CodeLocation. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of CodeLocation instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of CodeLocation instances. static List listFromJson(List json) { return json.map((value) => CodeLocation.fromJson(value)).toList(); } diff --git a/lib/src/model/coupon_params.dart b/lib/src/model/coupon_params.dart index ac0a360..7db7f04 100644 --- a/lib/src/model/coupon_params.dart +++ b/lib/src/model/coupon_params.dart @@ -1,10 +1,12 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Coupon parameters. Used for UpcaGs1DatabarCoupon, UpcaGs1Code128Coupon. class CouponParams { - /* Space between main the BarCode and supplement BarCode in Unit value. */ + /// Space between main the BarCode and supplement BarCode in Unit value. double? supplementSpace; + /// Constructor CouponParams(); @override @@ -12,25 +14,21 @@ class CouponParams { return 'CouponParams[supplementSpace=$supplementSpace, ]'; } + /// Creates a CouponParams instance from a JSON representation. CouponParams.fromJson(Map json) { supplementSpace = json['supplementSpace']?.toDouble(); } + /// Returns a JSON representation of CouponParams. Map toJson() { return {'SupplementSpace': supplementSpace}; } + /// Converts a list of JSON objects to a list of CouponParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of CouponParams instances. static List listFromJson(List json) { return json.map((value) => CouponParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = CouponParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/customer_information_interpreting_type.dart b/lib/src/model/customer_information_interpreting_type.dart index 7072bab..75e7903 100644 --- a/lib/src/model/customer_information_interpreting_type.dart +++ b/lib/src/model/customer_information_interpreting_type.dart @@ -1,8 +1,10 @@ +/// +/// CustomerInformationInterpretingType: [CTable, NTable, Other] class CustomerInformationInterpretingType { - /// The underlying value of this enum member. - String? value; + /// The underlying value of CustomerInformationInterpretingType enum. + late final String _value; - CustomerInformationInterpretingType._internal(this.value); + CustomerInformationInterpretingType._internal(this._value); /// static CustomerInformationInterpretingType cTable_ = @@ -16,35 +18,33 @@ class CustomerInformationInterpretingType { static CustomerInformationInterpretingType other_ = CustomerInformationInterpretingType._internal("Other"); + /// Creates a CustomerInformationInterpretingType instance from a JSON representation. CustomerInformationInterpretingType.fromJson(dynamic data) { switch (data) { case "CTable": - value = data; - break; case "NTable": - value = data; - break; case "Other": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(CustomerInformationInterpretingType data) { - return data.value; - } - + /// Returns a JSON representation of CustomerInformationInterpretingType. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of CustomerInformationInterpretingType instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of CustomerInformationInterpretingType instances. static List listFromJson( List json) { return json diff --git a/lib/src/model/data_bar_params.dart b/lib/src/model/data_bar_params.dart index cde1781..1c44a94 100644 --- a/lib/src/model/data_bar_params.dart +++ b/lib/src/model/data_bar_params.dart @@ -1,22 +1,24 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Databar parameters. class DataBarParams { - /* Height/Width ratio of 2D BarCode module. Used for DataBar stacked. */ + /// Height/Width ratio of 2D BarCode module. Used for DataBar stacked. double? aspectRatio; -/* Columns count. */ + /// Columns count. int? columns; -/* Rows count. */ + /// Rows count. int? rows; -/* Enables flag of 2D composite component with DataBar barcode */ + /// Enables flag of 2D composite component with DataBar barcode bool? is2DCompositeComponent; -/* If this flag is set, it allows only GS1 encoding standard for Databar barcode types */ + /// If this flag is set, it allows only GS1 encoding standard for Databar barcode types bool? isAllowOnlyGS1Encoding; + /// Constructor DataBarParams(); @override @@ -24,6 +26,7 @@ class DataBarParams { return 'DataBarParams[aspectRatio=$aspectRatio, columns=$columns, rows=$rows, is2DCompositeComponent=$is2DCompositeComponent, isAllowOnlyGS1Encoding=$isAllowOnlyGS1Encoding, ]'; } + /// Creates a DataBarParams instance from a JSON representation. DataBarParams.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); columns = json['columns']; @@ -32,6 +35,7 @@ class DataBarParams { isAllowOnlyGS1Encoding = json['isAllowOnlyGS1Encoding']; } + /// Returns a JSON representation of DataBarParams. Map toJson() { return { 'AspectRatio': aspectRatio, @@ -42,17 +46,11 @@ class DataBarParams { }; } + /// Converts a list of JSON objects to a list of DataBarParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DataBarParams instances. static List listFromJson(List json) { return json.map((value) => DataBarParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = DataBarParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/data_matrix_ecc_type.dart b/lib/src/model/data_matrix_ecc_type.dart index 0480556..90cfd8d 100644 --- a/lib/src/model/data_matrix_ecc_type.dart +++ b/lib/src/model/data_matrix_ecc_type.dart @@ -1,8 +1,10 @@ +/// +/// DataMatrixEccType: [EccAuto, Ecc000, Ecc050, Ecc080, Ecc100, Ecc140, Ecc200] class DataMatrixEccType { - /// The underlying value of this enum member. - String? value; + /// The underlying value of DataMatrixEccType enum. + late final String _value; - DataMatrixEccType._internal(this.value); + DataMatrixEccType._internal(this._value); /// static DataMatrixEccType eccAuto_ = DataMatrixEccType._internal("EccAuto"); @@ -25,47 +27,37 @@ class DataMatrixEccType { /// static DataMatrixEccType ecc200_ = DataMatrixEccType._internal("Ecc200"); + /// Creates a DataMatrixEccType instance from a JSON representation. DataMatrixEccType.fromJson(dynamic data) { switch (data) { case "EccAuto": - value = data; - break; case "Ecc000": - value = data; - break; case "Ecc050": - value = data; - break; case "Ecc080": - value = data; - break; case "Ecc100": - value = data; - break; case "Ecc140": - value = data; - break; case "Ecc200": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(DataMatrixEccType data) { - return data.value; - } - + /// Returns a JSON representation of DataMatrixEccType. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of DataMatrixEccType instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DataMatrixEccType instances. static List listFromJson(List json) { return json.map((value) => DataMatrixEccType.fromJson(value)).toList(); } diff --git a/lib/src/model/data_matrix_encode_mode.dart b/lib/src/model/data_matrix_encode_mode.dart index 0a653d5..937cce3 100644 --- a/lib/src/model/data_matrix_encode_mode.dart +++ b/lib/src/model/data_matrix_encode_mode.dart @@ -1,8 +1,10 @@ +/// DataMatrix encoder's encoding mode, default to Auto +/// DataMatrixEncodeMode: [Auto, ASCII, Full, Custom, C40, Text, EDIFACT, ANSIX12, ExtendedCodetext] class DataMatrixEncodeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of DataMatrixEncodeMode enum. + late final String _value; - DataMatrixEncodeMode._internal(this.value); + DataMatrixEncodeMode._internal(this._value); /// DataMatrix encoder's encoding mode, default to Auto static DataMatrixEncodeMode auto_ = DataMatrixEncodeMode._internal("Auto"); @@ -35,53 +37,39 @@ class DataMatrixEncodeMode { static DataMatrixEncodeMode extendedCodetext_ = DataMatrixEncodeMode._internal("ExtendedCodetext"); + /// Creates a DataMatrixEncodeMode instance from a JSON representation. DataMatrixEncodeMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "ASCII": - value = data; - break; case "Full": - value = data; - break; case "Custom": - value = data; - break; case "C40": - value = data; - break; case "Text": - value = data; - break; case "EDIFACT": - value = data; - break; case "ANSIX12": - value = data; - break; case "ExtendedCodetext": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(DataMatrixEncodeMode data) { - return data.value; - } - + /// Returns a JSON representation of DataMatrixEncodeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of DataMatrixEncodeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DataMatrixEncodeMode instances. static List listFromJson(List json) { return json.map((value) => DataMatrixEncodeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/data_matrix_params.dart b/lib/src/model/data_matrix_params.dart index 171f9fc..59ab9ad 100644 --- a/lib/src/model/data_matrix_params.dart +++ b/lib/src/model/data_matrix_params.dart @@ -2,37 +2,33 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// DataMatrix parameters. class DataMatrixParams { - /* Height/Width ratio of 2D BarCode module */ + /// Height/Width ratio of 2D BarCode module double? aspectRatio; -/* DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. */ - @Deprecated( - "This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. ") + /// DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. String? textEncoding; -/* DEPRECATED: Will be replaced with 'DataMatrix.Version' in the next release Columns count. */ - @Deprecated( - "Will be replaced with 'DataMatrix.Version' in the next release Columns count. ") + /// DEPRECATED: Will be replaced with 'DataMatrix.Version' in the next release Columns count. int? columns; -/* Datamatrix ECC type. Default value: DataMatrixEccType.Ecc200. */ + /// Datamatrix ECC type. Default value: DataMatrixEccType.Ecc200. DataMatrixEccType? dataMatrixEcc; -/* Encode mode of Datamatrix barcode. Default value: DataMatrixEncodeMode.Auto. */ + /// Encode mode of Datamatrix barcode. Default value: DataMatrixEncodeMode.Auto. DataMatrixEncodeMode? dataMatrixEncodeMode; -/* DEPRECATED: Will be replaced with 'DataMatrix.Version' in the next release Rows count. */ - @Deprecated( - "Will be replaced with 'DataMatrix.Version' in the next release Rows count. ") + /// DEPRECATED: Will be replaced with 'DataMatrix.Version' in the next release Rows count. int? rows; -/* Macro Characters 05 and 06 values are used to obtain more compact encoding in special modes. Can be used only with DataMatrixEccType.Ecc200 or DataMatrixEccType.EccAuto. Cannot be used with EncodeTypes.GS1DataMatrix Default value: MacroCharacters.None. */ + /// Macro Characters 05 and 06 values are used to obtain more compact encoding in special modes. Can be used only with DataMatrixEccType.Ecc200 or DataMatrixEccType.EccAuto. Cannot be used with EncodeTypes.GS1DataMatrix Default value: MacroCharacters.None. MacroCharacter? macroCharacters; -/* Sets a Datamatrix symbol size. Default value: DataMatrixVersion.Auto. */ + /// Sets a Datamatrix symbol size. Default value: DataMatrixVersion.Auto. DataMatrixVersion? version; + /// Constructor DataMatrixParams(); @override @@ -40,6 +36,7 @@ class DataMatrixParams { return 'DataMatrixParams[aspectRatio=$aspectRatio, textEncoding=$textEncoding, columns=$columns, dataMatrixEcc=$dataMatrixEcc, dataMatrixEncodeMode=$dataMatrixEncodeMode, rows=$rows, macroCharacters=$macroCharacters, version=$version, ]'; } + /// Creates a DataMatrixParams instance from a JSON representation. DataMatrixParams.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); textEncoding = json['textEncoding']; @@ -52,6 +49,7 @@ class DataMatrixParams { version = DataMatrixVersion.fromJson(json['version']); } + /// Returns a JSON representation of DataMatrixParams. Map toJson() { return { 'AspectRatio': aspectRatio, @@ -65,17 +63,11 @@ class DataMatrixParams { }; } + /// Converts a list of JSON objects to a list of DataMatrixParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DataMatrixParams instances. static List listFromJson(List json) { return json.map((value) => DataMatrixParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = DataMatrixParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/data_matrix_version.dart b/lib/src/model/data_matrix_version.dart index 2996841..0ead2e6 100644 --- a/lib/src/model/data_matrix_version.dart +++ b/lib/src/model/data_matrix_version.dart @@ -1,8 +1,10 @@ +/// +/// DataMatrixVersion: [Auto, RowsColumns, ECC000_9x9, ECC000_050_11x11, ECC000_100_13x13, ECC000_100_15x15, ECC000_140_17x17, ECC000_140_19x19, ECC000_140_21x21, ECC000_140_23x23, ECC000_140_25x25, ECC000_140_27x27, ECC000_140_29x29, ECC000_140_31x31, ECC000_140_33x33, ECC000_140_35x35, ECC000_140_37x37, ECC000_140_39x39, ECC000_140_41x41, ECC000_140_43x43, ECC000_140_45x45, ECC000_140_47x47, ECC000_140_49x49, ECC200_10x10, ECC200_12x12, ECC200_14x14, ECC200_16x16, ECC200_18x18, ECC200_20x20, ECC200_22x22, ECC200_24x24, ECC200_26x26, ECC200_32x32, ECC200_36x36, ECC200_40x40, ECC200_44x44, ECC200_48x48, ECC200_52x52, ECC200_64x64, ECC200_72x72, ECC200_80x80, ECC200_88x88, ECC200_96x96, ECC200_104x104, ECC200_120x120, ECC200_132x132, ECC200_144x144, ECC200_8x18, ECC200_8x32, ECC200_12x26, ECC200_12x36, ECC200_16x36, ECC200_16x48, DMRE_8x48, DMRE_8x64, DMRE_8x80, DMRE_8x96, DMRE_8x120, DMRE_8x144, DMRE_12x64, DMRE_12x88, DMRE_16x64, DMRE_20x36, DMRE_20x44, DMRE_20x64, DMRE_22x48, DMRE_24x48, DMRE_24x64, DMRE_26x40, DMRE_26x48, DMRE_26x64] class DataMatrixVersion { - /// The underlying value of this enum member. - String? value; + /// The underlying value of DataMatrixVersion enum. + late final String _value; - DataMatrixVersion._internal(this.value); + DataMatrixVersion._internal(this._value); /// static DataMatrixVersion auto_ = DataMatrixVersion._internal("Auto"); @@ -283,239 +285,101 @@ class DataMatrixVersion { static DataMatrixVersion dMRE26x64_ = DataMatrixVersion._internal("DMRE_26x64"); + /// Creates a DataMatrixVersion instance from a JSON representation. DataMatrixVersion.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "RowsColumns": - value = data; - break; case "ECC000_9x9": - value = data; - break; case "ECC000_050_11x11": - value = data; - break; case "ECC000_100_13x13": - value = data; - break; case "ECC000_100_15x15": - value = data; - break; case "ECC000_140_17x17": - value = data; - break; case "ECC000_140_19x19": - value = data; - break; case "ECC000_140_21x21": - value = data; - break; case "ECC000_140_23x23": - value = data; - break; case "ECC000_140_25x25": - value = data; - break; case "ECC000_140_27x27": - value = data; - break; case "ECC000_140_29x29": - value = data; - break; case "ECC000_140_31x31": - value = data; - break; case "ECC000_140_33x33": - value = data; - break; case "ECC000_140_35x35": - value = data; - break; case "ECC000_140_37x37": - value = data; - break; case "ECC000_140_39x39": - value = data; - break; case "ECC000_140_41x41": - value = data; - break; case "ECC000_140_43x43": - value = data; - break; case "ECC000_140_45x45": - value = data; - break; case "ECC000_140_47x47": - value = data; - break; case "ECC000_140_49x49": - value = data; - break; case "ECC200_10x10": - value = data; - break; case "ECC200_12x12": - value = data; - break; case "ECC200_14x14": - value = data; - break; case "ECC200_16x16": - value = data; - break; case "ECC200_18x18": - value = data; - break; case "ECC200_20x20": - value = data; - break; case "ECC200_22x22": - value = data; - break; case "ECC200_24x24": - value = data; - break; case "ECC200_26x26": - value = data; - break; case "ECC200_32x32": - value = data; - break; case "ECC200_36x36": - value = data; - break; case "ECC200_40x40": - value = data; - break; case "ECC200_44x44": - value = data; - break; case "ECC200_48x48": - value = data; - break; case "ECC200_52x52": - value = data; - break; case "ECC200_64x64": - value = data; - break; case "ECC200_72x72": - value = data; - break; case "ECC200_80x80": - value = data; - break; case "ECC200_88x88": - value = data; - break; case "ECC200_96x96": - value = data; - break; case "ECC200_104x104": - value = data; - break; case "ECC200_120x120": - value = data; - break; case "ECC200_132x132": - value = data; - break; case "ECC200_144x144": - value = data; - break; case "ECC200_8x18": - value = data; - break; case "ECC200_8x32": - value = data; - break; case "ECC200_12x26": - value = data; - break; case "ECC200_12x36": - value = data; - break; case "ECC200_16x36": - value = data; - break; case "ECC200_16x48": - value = data; - break; case "DMRE_8x48": - value = data; - break; case "DMRE_8x64": - value = data; - break; case "DMRE_8x80": - value = data; - break; case "DMRE_8x96": - value = data; - break; case "DMRE_8x120": - value = data; - break; case "DMRE_8x144": - value = data; - break; case "DMRE_12x64": - value = data; - break; case "DMRE_12x88": - value = data; - break; case "DMRE_16x64": - value = data; - break; case "DMRE_20x36": - value = data; - break; case "DMRE_20x44": - value = data; - break; case "DMRE_20x64": - value = data; - break; case "DMRE_22x48": - value = data; - break; case "DMRE_24x48": - value = data; - break; case "DMRE_24x64": - value = data; - break; case "DMRE_26x40": - value = data; - break; case "DMRE_26x48": - value = data; - break; case "DMRE_26x64": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(DataMatrixVersion data) { - return data.value; - } - + /// Returns a JSON representation of DataMatrixVersion. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of DataMatrixVersion instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DataMatrixVersion instances. static List listFromJson(List json) { return json.map((value) => DataMatrixVersion.fromJson(value)).toList(); } diff --git a/lib/src/model/decode_barcode_type.dart b/lib/src/model/decode_barcode_type.dart index e507d87..f6a6c80 100644 --- a/lib/src/model/decode_barcode_type.dart +++ b/lib/src/model/decode_barcode_type.dart @@ -1,8 +1,10 @@ +/// See DecodeType +/// DecodeBarcodeType: [all, AustraliaPost, Aztec, ISBN, Codabar, Code11, Code128, GS1Code128, Code39Extended, Code39Standard, Code93Extended, Code93Standard, DataMatrix, DeutschePostIdentcode, DeutschePostLeitcode, EAN13, EAN14, EAN8, IATA2of5, Interleaved2of5, ISSN, ISMN, ItalianPost25, ITF14, ITF6, MacroPdf417, Matrix2of5, MSI, OneCode, OPC, PatchCode, Pdf417, MicroPdf417, Planet, Postnet, PZN, QR, MicroQR, RM4SCC, SCC14, SSCC18, Standard2of5, Supplement, UPCA, UPCE, VIN, Pharmacode, GS1DataMatrix, DatabarOmniDirectional, DatabarTruncated, DatabarLimited, DatabarExpanded, SwissPostParcel, AustralianPosteParcel, Code16K, DatabarStackedOmniDirectional, DatabarStacked, DatabarExpandedStacked, CompactPdf417, GS1QR, MaxiCode, MicrE13B, Code32, DataLogic2of5, DotCode, DutchKIX, CodablockF, Mailmark, GS1DotCode, HIBCCode39LIC, HIBCCode128LIC, HIBCAztecLIC, HIBCDataMatrixLIC, HIBCQRLIC, HIBCCode39PAS, HIBCCode128PAS, HIBCAztecPAS, HIBCDataMatrixPAS, HIBCQRPAS, HanXin, GS1HanXin, GS1Aztec, GS1CompositeBar, GS1MicroPdf417, mostCommonlyUsed] class DecodeBarcodeType { - /// The underlying value of this enum member. - String? value; + /// The underlying value of DecodeBarcodeType enum. + late final String _value; - DecodeBarcodeType._internal(this.value); + DecodeBarcodeType._internal(this._value); /// See DecodeType static DecodeBarcodeType all_ = DecodeBarcodeType._internal("all"); @@ -305,281 +307,115 @@ class DecodeBarcodeType { static DecodeBarcodeType mostCommonlyUsed_ = DecodeBarcodeType._internal("mostCommonlyUsed"); + /// Creates a DecodeBarcodeType instance from a JSON representation. DecodeBarcodeType.fromJson(dynamic data) { switch (data) { case "all": - value = data; - break; case "AustraliaPost": - value = data; - break; case "Aztec": - value = data; - break; case "ISBN": - value = data; - break; case "Codabar": - value = data; - break; case "Code11": - value = data; - break; case "Code128": - value = data; - break; case "GS1Code128": - value = data; - break; case "Code39Extended": - value = data; - break; case "Code39Standard": - value = data; - break; case "Code93Extended": - value = data; - break; case "Code93Standard": - value = data; - break; case "DataMatrix": - value = data; - break; case "DeutschePostIdentcode": - value = data; - break; case "DeutschePostLeitcode": - value = data; - break; case "EAN13": - value = data; - break; case "EAN14": - value = data; - break; case "EAN8": - value = data; - break; case "IATA2of5": - value = data; - break; case "Interleaved2of5": - value = data; - break; case "ISSN": - value = data; - break; case "ISMN": - value = data; - break; case "ItalianPost25": - value = data; - break; case "ITF14": - value = data; - break; case "ITF6": - value = data; - break; case "MacroPdf417": - value = data; - break; case "Matrix2of5": - value = data; - break; case "MSI": - value = data; - break; case "OneCode": - value = data; - break; case "OPC": - value = data; - break; case "PatchCode": - value = data; - break; case "Pdf417": - value = data; - break; case "MicroPdf417": - value = data; - break; case "Planet": - value = data; - break; case "Postnet": - value = data; - break; case "PZN": - value = data; - break; case "QR": - value = data; - break; case "MicroQR": - value = data; - break; case "RM4SCC": - value = data; - break; case "SCC14": - value = data; - break; case "SSCC18": - value = data; - break; case "Standard2of5": - value = data; - break; case "Supplement": - value = data; - break; case "UPCA": - value = data; - break; case "UPCE": - value = data; - break; case "VIN": - value = data; - break; case "Pharmacode": - value = data; - break; case "GS1DataMatrix": - value = data; - break; case "DatabarOmniDirectional": - value = data; - break; case "DatabarTruncated": - value = data; - break; case "DatabarLimited": - value = data; - break; case "DatabarExpanded": - value = data; - break; case "SwissPostParcel": - value = data; - break; case "AustralianPosteParcel": - value = data; - break; case "Code16K": - value = data; - break; case "DatabarStackedOmniDirectional": - value = data; - break; case "DatabarStacked": - value = data; - break; case "DatabarExpandedStacked": - value = data; - break; case "CompactPdf417": - value = data; - break; case "GS1QR": - value = data; - break; case "MaxiCode": - value = data; - break; case "MicrE13B": - value = data; - break; case "Code32": - value = data; - break; case "DataLogic2of5": - value = data; - break; case "DotCode": - value = data; - break; case "DutchKIX": - value = data; - break; case "CodablockF": - value = data; - break; case "Mailmark": - value = data; - break; case "GS1DotCode": - value = data; - break; case "HIBCCode39LIC": - value = data; - break; case "HIBCCode128LIC": - value = data; - break; case "HIBCAztecLIC": - value = data; - break; case "HIBCDataMatrixLIC": - value = data; - break; case "HIBCQRLIC": - value = data; - break; case "HIBCCode39PAS": - value = data; - break; case "HIBCCode128PAS": - value = data; - break; case "HIBCAztecPAS": - value = data; - break; case "HIBCDataMatrixPAS": - value = data; - break; case "HIBCQRPAS": - value = data; - break; case "HanXin": - value = data; - break; case "GS1HanXin": - value = data; - break; case "GS1Aztec": - value = data; - break; case "GS1CompositeBar": - value = data; - break; case "GS1MicroPdf417": - value = data; - break; case "mostCommonlyUsed": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(DecodeBarcodeType data) { - return data.value; - } - + /// Returns a JSON representation of DecodeBarcodeType. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of DecodeBarcodeType instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DecodeBarcodeType instances. static List listFromJson(List json) { return json.map((value) => DecodeBarcodeType.fromJson(value)).toList(); } diff --git a/lib/src/model/disc_usage.dart b/lib/src/model/disc_usage.dart index e78e04f..abebd72 100644 --- a/lib/src/model/disc_usage.dart +++ b/lib/src/model/disc_usage.dart @@ -1,13 +1,15 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Class for disc space information. class DiscUsage { - /* Application used disc space. */ + /// Application used disc space. int? usedSize; -/* Total disc space. */ + /// Total disc space. int? totalSize; + /// Constructor DiscUsage(); @override @@ -15,26 +17,22 @@ class DiscUsage { return 'DiscUsage[usedSize=$usedSize, totalSize=$totalSize, ]'; } + /// Creates a DiscUsage instance from a JSON representation. DiscUsage.fromJson(Map json) { usedSize = json['usedSize']; totalSize = json['totalSize']; } + /// Returns a JSON representation of DiscUsage. Map toJson() { return {'UsedSize': usedSize, 'TotalSize': totalSize}; } + /// Converts a list of JSON objects to a list of DiscUsage instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DiscUsage instances. static List listFromJson(List json) { return json.map((value) => DiscUsage.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = DiscUsage.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/dot_code_encode_mode.dart b/lib/src/model/dot_code_encode_mode.dart index 5d43366..5dd4f78 100644 --- a/lib/src/model/dot_code_encode_mode.dart +++ b/lib/src/model/dot_code_encode_mode.dart @@ -1,8 +1,10 @@ +/// +/// DotCodeEncodeMode: [Auto, Bytes, ExtendedCodetext] class DotCodeEncodeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of DotCodeEncodeMode enum. + late final String _value; - DotCodeEncodeMode._internal(this.value); + DotCodeEncodeMode._internal(this._value); /// static DotCodeEncodeMode auto_ = DotCodeEncodeMode._internal("Auto"); @@ -14,35 +16,33 @@ class DotCodeEncodeMode { static DotCodeEncodeMode extendedCodetext_ = DotCodeEncodeMode._internal("ExtendedCodetext"); + /// Creates a DotCodeEncodeMode instance from a JSON representation. DotCodeEncodeMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Bytes": - value = data; - break; case "ExtendedCodetext": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(DotCodeEncodeMode data) { - return data.value; - } - + /// Returns a JSON representation of DotCodeEncodeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of DotCodeEncodeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DotCodeEncodeMode instances. static List listFromJson(List json) { return json.map((value) => DotCodeEncodeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/dot_code_params.dart b/lib/src/model/dot_code_params.dart index b881529..21dd591 100644 --- a/lib/src/model/dot_code_params.dart +++ b/lib/src/model/dot_code_params.dart @@ -2,25 +2,27 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// DotCode parameters. class DotCodeParams { - /* Height/Width ratio of 2D BarCode module. */ + /// Height/Width ratio of 2D BarCode module. double? aspectRatio; -/* Identifies columns count. Sum of the number of rows plus the number of columns of a DotCode symbol must be odd. Number of columns must be at least 5. */ + /// Identifies columns count. Sum of the number of rows plus the number of columns of a DotCode symbol must be odd. Number of columns must be at least 5. int? columns; -/* Identifies DotCode encode mode. Default value: Auto. */ + /// Identifies DotCode encode mode. Default value: Auto. DotCodeEncodeMode? encodeMode; -/* Identifies ECI encoding. Used when DotCodeEncodeMode is Auto. Default value: ISO-8859-1. */ + /// Identifies ECI encoding. Used when DotCodeEncodeMode is Auto. Default value: ISO-8859-1. ECIEncodings? eCIEncoding; -/* Indicates whether code is used for instruct reader to interpret the following data as instructions for initialization or reprogramming of the bar code reader. Default value is false. */ + /// Indicates whether code is used for instruct reader to interpret the following data as instructions for initialization or reprogramming of the bar code reader. Default value is false. bool? isReaderInitialization; -/* Identifies rows count. Sum of the number of rows plus the number of columns of a DotCode symbol must be odd. Number of rows must be at least 5. */ + /// Identifies rows count. Sum of the number of rows plus the number of columns of a DotCode symbol must be odd. Number of rows must be at least 5. int? rows; + /// Constructor DotCodeParams(); @override @@ -28,6 +30,7 @@ class DotCodeParams { return 'DotCodeParams[aspectRatio=$aspectRatio, columns=$columns, encodeMode=$encodeMode, eCIEncoding=$eCIEncoding, isReaderInitialization=$isReaderInitialization, rows=$rows, ]'; } + /// Creates a DotCodeParams instance from a JSON representation. DotCodeParams.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); columns = json['columns']; @@ -37,6 +40,7 @@ class DotCodeParams { rows = json['rows']; } + /// Returns a JSON representation of DotCodeParams. Map toJson() { return { 'AspectRatio': aspectRatio, @@ -48,17 +52,11 @@ class DotCodeParams { }; } + /// Converts a list of JSON objects to a list of DotCodeParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of DotCodeParams instances. static List listFromJson(List json) { return json.map((value) => DotCodeParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = DotCodeParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/eci_encodings.dart b/lib/src/model/eci_encodings.dart index cc583c1..19a2787 100644 --- a/lib/src/model/eci_encodings.dart +++ b/lib/src/model/eci_encodings.dart @@ -1,8 +1,10 @@ +/// +/// ECIEncodings: [NONE, ISO_8859_1, ISO_8859_2, ISO_8859_3, ISO_8859_4, ISO_8859_5, ISO_8859_6, ISO_8859_7, ISO_8859_8, ISO_8859_9, ISO_8859_10, ISO_8859_11, ISO_8859_13, ISO_8859_14, ISO_8859_15, ISO_8859_16, Shift_JIS, Win1250, Win1251, Win1252, Win1256, UTF16BE, UTF8, US_ASCII, Big5, GB18030, EUC_KR] class ECIEncodings { - /// The underlying value of this enum member. - String? value; + /// The underlying value of ECIEncodings enum. + late final String _value; - ECIEncodings._internal(this.value); + ECIEncodings._internal(this._value); /// static ECIEncodings nONE_ = ECIEncodings._internal("NONE"); @@ -85,107 +87,57 @@ class ECIEncodings { /// static ECIEncodings eUCKR_ = ECIEncodings._internal("EUC_KR"); + /// Creates a ECIEncodings instance from a JSON representation. ECIEncodings.fromJson(dynamic data) { switch (data) { case "NONE": - value = data; - break; case "ISO_8859_1": - value = data; - break; case "ISO_8859_2": - value = data; - break; case "ISO_8859_3": - value = data; - break; case "ISO_8859_4": - value = data; - break; case "ISO_8859_5": - value = data; - break; case "ISO_8859_6": - value = data; - break; case "ISO_8859_7": - value = data; - break; case "ISO_8859_8": - value = data; - break; case "ISO_8859_9": - value = data; - break; case "ISO_8859_10": - value = data; - break; case "ISO_8859_11": - value = data; - break; case "ISO_8859_13": - value = data; - break; case "ISO_8859_14": - value = data; - break; case "ISO_8859_15": - value = data; - break; case "ISO_8859_16": - value = data; - break; case "Shift_JIS": - value = data; - break; case "Win1250": - value = data; - break; case "Win1251": - value = data; - break; case "Win1252": - value = data; - break; case "Win1256": - value = data; - break; case "UTF16BE": - value = data; - break; case "UTF8": - value = data; - break; case "US_ASCII": - value = data; - break; case "Big5": - value = data; - break; case "GB18030": - value = data; - break; case "EUC_KR": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(ECIEncodings data) { - return data.value; - } - + /// Returns a JSON representation of ECIEncodings. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of ECIEncodings instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ECIEncodings instances. static List listFromJson(List json) { return json.map((value) => ECIEncodings.fromJson(value)).toList(); } diff --git a/lib/src/model/enable_checksum.dart b/lib/src/model/enable_checksum.dart index 5eea9c6..0d94ab7 100644 --- a/lib/src/model/enable_checksum.dart +++ b/lib/src/model/enable_checksum.dart @@ -1,8 +1,10 @@ +/// +/// EnableChecksum: [Default, Yes, No] class EnableChecksum { - /// The underlying value of this enum member. - String? value; + /// The underlying value of EnableChecksum enum. + late final String _value; - EnableChecksum._internal(this.value); + EnableChecksum._internal(this._value); /// static EnableChecksum default_ = EnableChecksum._internal("Default"); @@ -13,35 +15,33 @@ class EnableChecksum { /// static EnableChecksum no_ = EnableChecksum._internal("No"); + /// Creates a EnableChecksum instance from a JSON representation. EnableChecksum.fromJson(dynamic data) { switch (data) { case "Default": - value = data; - break; case "Yes": - value = data; - break; case "No": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(EnableChecksum data) { - return data.value; - } - + /// Returns a JSON representation of EnableChecksum. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of EnableChecksum instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of EnableChecksum instances. static List listFromJson(List json) { return json.map((value) => EnableChecksum.fromJson(value)).toList(); } diff --git a/lib/src/model/encode_barcode_type.dart b/lib/src/model/encode_barcode_type.dart index 4538dd5..aed6d2c 100644 --- a/lib/src/model/encode_barcode_type.dart +++ b/lib/src/model/encode_barcode_type.dart @@ -1,8 +1,10 @@ +/// See EncodeTypes +/// EncodeBarcodeType: [Codabar, Code11, Code39Standard, Code39Extended, Code93Standard, Code93Extended, Code128, GS1Code128, EAN8, EAN13, EAN14, SCC14, SSCC18, UPCA, UPCE, ISBN, ISSN, ISMN, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, IATA2of5, ITF14, ITF6, MSI, VIN, DeutschePostIdentcode, DeutschePostLeitcode, OPC, PZN, Code16K, Pharmacode, DataMatrix, QR, Aztec, Pdf417, MacroPdf417, AustraliaPost, Postnet, Planet, OneCode, RM4SCC, DatabarOmniDirectional, DatabarTruncated, DatabarLimited, DatabarExpanded, SingaporePost, GS1DataMatrix, AustralianPosteParcel, SwissPostParcel, PatchCode, DatabarExpandedStacked, DatabarStacked, DatabarStackedOmniDirectional, MicroPdf417, GS1QR, MaxiCode, Code32, DataLogic2of5, DotCode, DutchKIX, UpcaGs1Code128Coupon, UpcaGs1DatabarCoupon, CodablockF, GS1CodablockF, Mailmark, GS1DotCode, HanXin, GS1HanXin, GS1Aztec, GS1MicroPdf417] class EncodeBarcodeType { - /// The underlying value of this enum member. - String? value; + /// The underlying value of EncodeBarcodeType enum. + late final String _value; - EncodeBarcodeType._internal(this.value); + EncodeBarcodeType._internal(this._value); /// See EncodeTypes static EncodeBarcodeType codabar_ = EncodeBarcodeType._internal("Codabar"); @@ -256,242 +258,102 @@ class EncodeBarcodeType { static EncodeBarcodeType gS1MicroPdf417_ = EncodeBarcodeType._internal("GS1MicroPdf417"); + /// Creates a EncodeBarcodeType instance from a JSON representation. EncodeBarcodeType.fromJson(dynamic data) { switch (data) { case "Codabar": - value = data; - break; case "Code11": - value = data; - break; case "Code39Standard": - value = data; - break; case "Code39Extended": - value = data; - break; case "Code93Standard": - value = data; - break; case "Code93Extended": - value = data; - break; case "Code128": - value = data; - break; case "GS1Code128": - value = data; - break; case "EAN8": - value = data; - break; case "EAN13": - value = data; - break; case "EAN14": - value = data; - break; case "SCC14": - value = data; - break; case "SSCC18": - value = data; - break; case "UPCA": - value = data; - break; case "UPCE": - value = data; - break; case "ISBN": - value = data; - break; case "ISSN": - value = data; - break; case "ISMN": - value = data; - break; case "Standard2of5": - value = data; - break; case "Interleaved2of5": - value = data; - break; case "Matrix2of5": - value = data; - break; case "ItalianPost25": - value = data; - break; case "IATA2of5": - value = data; - break; case "ITF14": - value = data; - break; case "ITF6": - value = data; - break; case "MSI": - value = data; - break; case "VIN": - value = data; - break; case "DeutschePostIdentcode": - value = data; - break; case "DeutschePostLeitcode": - value = data; - break; case "OPC": - value = data; - break; case "PZN": - value = data; - break; case "Code16K": - value = data; - break; case "Pharmacode": - value = data; - break; case "DataMatrix": - value = data; - break; case "QR": - value = data; - break; case "Aztec": - value = data; - break; case "Pdf417": - value = data; - break; case "MacroPdf417": - value = data; - break; case "AustraliaPost": - value = data; - break; case "Postnet": - value = data; - break; case "Planet": - value = data; - break; case "OneCode": - value = data; - break; case "RM4SCC": - value = data; - break; case "DatabarOmniDirectional": - value = data; - break; case "DatabarTruncated": - value = data; - break; case "DatabarLimited": - value = data; - break; case "DatabarExpanded": - value = data; - break; case "SingaporePost": - value = data; - break; case "GS1DataMatrix": - value = data; - break; case "AustralianPosteParcel": - value = data; - break; case "SwissPostParcel": - value = data; - break; case "PatchCode": - value = data; - break; case "DatabarExpandedStacked": - value = data; - break; case "DatabarStacked": - value = data; - break; case "DatabarStackedOmniDirectional": - value = data; - break; case "MicroPdf417": - value = data; - break; case "GS1QR": - value = data; - break; case "MaxiCode": - value = data; - break; case "Code32": - value = data; - break; case "DataLogic2of5": - value = data; - break; case "DotCode": - value = data; - break; case "DutchKIX": - value = data; - break; case "UpcaGs1Code128Coupon": - value = data; - break; case "UpcaGs1DatabarCoupon": - value = data; - break; case "CodablockF": - value = data; - break; case "GS1CodablockF": - value = data; - break; case "Mailmark": - value = data; - break; case "GS1DotCode": - value = data; - break; case "HanXin": - value = data; - break; case "GS1HanXin": - value = data; - break; case "GS1Aztec": - value = data; - break; case "GS1MicroPdf417": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(EncodeBarcodeType data) { - return data.value; - } - + /// Returns a JSON representation of EncodeBarcodeType. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of EncodeBarcodeType instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of EncodeBarcodeType instances. static List listFromJson(List json) { return json.map((value) => EncodeBarcodeType.fromJson(value)).toList(); } diff --git a/lib/src/model/error.dart b/lib/src/model/error.dart index 379eaad..0a7044e 100644 --- a/lib/src/model/error.dart +++ b/lib/src/model/error.dart @@ -2,19 +2,21 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Error class Error { - /* Code */ + /// Code String? code; -/* Message */ + /// Message String? message; -/* Description */ + /// Description String? description; -/* Inner Error */ + /// Inner Error ErrorDetails? innerError; + /// Constructor Error(); @override @@ -22,6 +24,7 @@ class Error { return 'Error[code=$code, message=$message, description=$description, innerError=$innerError, ]'; } + /// Creates a Error instance from a JSON representation. Error.fromJson(Map json) { code = json['code']; message = json['message']; @@ -29,6 +32,7 @@ class Error { innerError = ErrorDetails.fromJson(json['innerError']); } + /// Returns a JSON representation of Error. Map toJson() { return { 'Code': code, @@ -38,17 +42,11 @@ class Error { }; } + /// Converts a list of JSON objects to a list of Error instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Error instances. static List listFromJson(List json) { return json.map((value) => Error.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = Error.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/error_details.dart b/lib/src/model/error_details.dart index ec2a7a8..a5b8640 100644 --- a/lib/src/model/error_details.dart +++ b/lib/src/model/error_details.dart @@ -1,13 +1,15 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// The error details class ErrorDetails { - /* The request id */ + /// The request id String? requestId; -/* Date */ + /// Date DateTime? date; + /// Constructor ErrorDetails(); @override @@ -15,11 +17,13 @@ class ErrorDetails { return 'ErrorDetails[requestId=$requestId, date=$date, ]'; } + /// Creates a ErrorDetails instance from a JSON representation. ErrorDetails.fromJson(Map json) { requestId = json['requestId']; date = json['date'] == null ? null : DateTime.parse(json['date']); } + /// Returns a JSON representation of ErrorDetails. Map toJson() { return { 'RequestId': requestId, @@ -27,17 +31,11 @@ class ErrorDetails { }; } + /// Converts a list of JSON objects to a list of ErrorDetails instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ErrorDetails instances. static List listFromJson(List json) { return json.map((value) => ErrorDetails.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = ErrorDetails.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/file_version.dart b/lib/src/model/file_version.dart index 239a6da..0c7e101 100644 --- a/lib/src/model/file_version.dart +++ b/lib/src/model/file_version.dart @@ -1,28 +1,30 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// FileVersion class FileVersion { - /* File or folder name. */ + /// File or folder name. String? name; -/* True if it is a folder. */ + /// True if it is a folder. bool? isFolder; -/* File or folder last modified DateTime. */ + /// File or folder last modified DateTime. DateTime? modifiedDate; -/* File or folder size. */ + /// File or folder size. int? size; -/* File or folder path. */ + /// File or folder path. String? path; -/* File Version ID. */ + /// File Version ID. String? versionId; -/* Specifies whether the file is (true) or is not (false) the latest version of an file. */ + /// Specifies whether the file is (true) or is not (false) the latest version of an file. bool? isLatest; + /// Constructor FileVersion(); @override @@ -30,6 +32,7 @@ class FileVersion { return 'FileVersion[name=$name, isFolder=$isFolder, modifiedDate=$modifiedDate, size=$size, path=$path, versionId=$versionId, isLatest=$isLatest, ]'; } + /// Creates a FileVersion instance from a JSON representation. FileVersion.fromJson(Map json) { name = json['name']; isFolder = json['isFolder']; @@ -42,6 +45,7 @@ class FileVersion { isLatest = json['isLatest']; } + /// Returns a JSON representation of FileVersion. Map toJson() { return { 'Name': name, @@ -55,17 +59,11 @@ class FileVersion { }; } + /// Converts a list of JSON objects to a list of FileVersion instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of FileVersion instances. static List listFromJson(List json) { return json.map((value) => FileVersion.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = FileVersion.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/file_versions.dart b/lib/src/model/file_versions.dart index 7da4ab0..16e3dde 100644 --- a/lib/src/model/file_versions.dart +++ b/lib/src/model/file_versions.dart @@ -2,10 +2,12 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// File versions FileVersion. class FileVersions { - /* File versions FileVersion. */ + /// File versions FileVersion. List? value = []; + /// Constructor FileVersions(); @override @@ -13,25 +15,21 @@ class FileVersions { return 'FileVersions[value=$value, ]'; } + /// Creates a FileVersions instance from a JSON representation. FileVersions.fromJson(Map json) { value = FileVersion.listFromJson(json['value']); } + /// Returns a JSON representation of FileVersions. Map toJson() { return {'Value': value}; } + /// Converts a list of JSON objects to a list of FileVersions instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of FileVersions instances. static List listFromJson(List json) { return json.map((value) => FileVersions.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = FileVersions.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/files_list.dart b/lib/src/model/files_list.dart index fdb4b46..a87e400 100644 --- a/lib/src/model/files_list.dart +++ b/lib/src/model/files_list.dart @@ -2,10 +2,12 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Files list class FilesList { - /* Files and folders contained by folder StorageFile. */ + /// Files and folders contained by folder StorageFile. List? value = []; + /// Constructor FilesList(); @override @@ -13,25 +15,21 @@ class FilesList { return 'FilesList[value=$value, ]'; } + /// Creates a FilesList instance from a JSON representation. FilesList.fromJson(Map json) { value = StorageFile.listFromJson(json['value']); } + /// Returns a JSON representation of FilesList. Map toJson() { return {'Value': value}; } + /// Converts a list of JSON objects to a list of FilesList instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of FilesList instances. static List listFromJson(List json) { return json.map((value) => FilesList.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = FilesList.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/files_upload_result.dart b/lib/src/model/files_upload_result.dart index dfcd4e6..4105a25 100644 --- a/lib/src/model/files_upload_result.dart +++ b/lib/src/model/files_upload_result.dart @@ -2,13 +2,15 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// File upload result class FilesUploadResult { - /* List of uploaded file names */ + /// List of uploaded file names List? uploaded = []; -/* List of errors. */ + /// List of errors. List? errors = []; + /// Constructor FilesUploadResult(); @override @@ -16,27 +18,23 @@ class FilesUploadResult { return 'FilesUploadResult[uploaded=$uploaded, errors=$errors, ]'; } + /// Creates a FilesUploadResult instance from a JSON representation. FilesUploadResult.fromJson(Map json) { uploaded = (json['uploaded'] as List).map((item) => item as String).toList(); errors = Error.listFromJson(json['errors']); } + /// Returns a JSON representation of FilesUploadResult. Map toJson() { return {'Uploaded': uploaded, 'Errors': errors}; } + /// Converts a list of JSON objects to a list of FilesUploadResult instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of FilesUploadResult instances. static List listFromJson(List json) { return json.map((value) => FilesUploadResult.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = FilesUploadResult.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/font_mode.dart b/lib/src/model/font_mode.dart index fb836c6..a0ea7fc 100644 --- a/lib/src/model/font_mode.dart +++ b/lib/src/model/font_mode.dart @@ -1,8 +1,10 @@ +/// +/// FontMode: [Auto, Manual] class FontMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of FontMode enum. + late final String _value; - FontMode._internal(this.value); + FontMode._internal(this._value); /// static FontMode auto_ = FontMode._internal("Auto"); @@ -10,32 +12,32 @@ class FontMode { /// static FontMode manual_ = FontMode._internal("Manual"); + /// Creates a FontMode instance from a JSON representation. FontMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Manual": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(FontMode data) { - return data.value; - } - + /// Returns a JSON representation of FontMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of FontMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of FontMode instances. static List listFromJson(List json) { return json.map((value) => FontMode.fromJson(value)).toList(); } diff --git a/lib/src/model/font_params.dart b/lib/src/model/font_params.dart index 02d84a3..a0eb8c3 100644 --- a/lib/src/model/font_params.dart +++ b/lib/src/model/font_params.dart @@ -2,16 +2,18 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Font. class FontParams { - /* Font family. */ + /// Font family. String? family; -/* Font size in units. */ + /// Font size in units. double? size; -/* Font style. */ + /// Font style. FontStyle? style; + /// Constructor FontParams(); @override @@ -19,27 +21,23 @@ class FontParams { return 'FontParams[family=$family, size=$size, style=$style, ]'; } + /// Creates a FontParams instance from a JSON representation. FontParams.fromJson(Map json) { family = json['family']; size = json['size']?.toDouble(); style = FontStyle.fromJson(json['style']); } + /// Returns a JSON representation of FontParams. Map toJson() { return {'Family': family, 'Size': size, 'Style': style}; } + /// Converts a list of JSON objects to a list of FontParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of FontParams instances. static List listFromJson(List json) { return json.map((value) => FontParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = FontParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/font_style.dart b/lib/src/model/font_style.dart index 48f4e3a..c2bf066 100644 --- a/lib/src/model/font_style.dart +++ b/lib/src/model/font_style.dart @@ -1,8 +1,10 @@ +/// +/// FontStyle: [Regular, Bold, Italic, Underline, Strikeout] class FontStyle { - /// The underlying value of this enum member. - String? value; + /// The underlying value of FontStyle enum. + late final String _value; - FontStyle._internal(this.value); + FontStyle._internal(this._value); /// static FontStyle regular_ = FontStyle._internal("Regular"); @@ -19,41 +21,35 @@ class FontStyle { /// static FontStyle strikeout_ = FontStyle._internal("Strikeout"); + /// Creates a FontStyle instance from a JSON representation. FontStyle.fromJson(dynamic data) { switch (data) { case "Regular": - value = data; - break; case "Bold": - value = data; - break; case "Italic": - value = data; - break; case "Underline": - value = data; - break; case "Strikeout": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(FontStyle data) { - return data.value; - } - + /// Returns a JSON representation of FontStyle. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of FontStyle instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of FontStyle instances. static List listFromJson(List json) { return json.map((value) => FontStyle.fromJson(value)).toList(); } diff --git a/lib/src/model/generator_params.dart b/lib/src/model/generator_params.dart index 9fd95ca..8feba23 100644 --- a/lib/src/model/generator_params.dart +++ b/lib/src/model/generator_params.dart @@ -2,177 +2,177 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Represents extended BarcodeGenerator params. class GeneratorParams { - /* Type of barcode to generate. */ + /// Type of barcode to generate. EncodeBarcodeType? typeOfBarcode; -/* Text to encode. */ + /// Text to encode. String? text; -/* Text that will be displayed instead of codetext in 2D barcodes. Used for: Aztec, Pdf417, DataMatrix, QR, MaxiCode, DotCode */ + /// Text that will be displayed instead of codetext in 2D barcodes. Used for: Aztec, Pdf417, DataMatrix, QR, MaxiCode, DotCode String? twoDDisplayText; -/* Specify the displaying Text Location, set to CodeLocation.None to hide CodeText. Default value: CodeLocation.Below. */ + /// Specify the displaying Text Location, set to CodeLocation.None to hide CodeText. Default value: CodeLocation.Below. CodeLocation? textLocation; -/* Text alignment. */ + /// Text alignment. TextAlignment? textAlignment; -/* Specify the displaying CodeText's Color. Default value: Color.Black. */ + /// Specify the displaying CodeText's Color. Default value: Color.Black. String? textColor; -/* Specify the displaying Text's font. Default value: Arial 5pt regular. Ignored if FontSizeMode is set to FontSizeMode.Auto. */ + /// Specify the displaying Text's font. Default value: Arial 5pt regular. Ignored if FontSizeMode is set to FontSizeMode.Auto. FontParams? font; -/* Specify FontSizeMode. If FontSizeMode is set to Auto, font size will be calculated automatically based on xDimension value. It is recommended to use FontSizeMode.Auto especially in AutoSizeMode.Nearest or AutoSizeMode.Interpolation. Default value: FontSizeMode.Auto. */ + /// Specify FontSizeMode. If FontSizeMode is set to Auto, font size will be calculated automatically based on xDimension value. It is recommended to use FontSizeMode.Auto especially in AutoSizeMode.Nearest or AutoSizeMode.Interpolation. Default value: FontSizeMode.Auto. FontMode? fontSizeMode; -/* Specify word wraps (line breaks) within text. Default value: false. */ + /// Specify word wraps (line breaks) within text. Default value: false. bool? noWrap; -/* Resolution of the BarCode image. One value for both dimensions. Default value: 96 dpi. */ + /// Resolution of the BarCode image. One value for both dimensions. Default value: 96 dpi. double? resolution; -/* DEPRECATED: Use 'Resolution' instead. */ - @Deprecated("Use 'Resolution' instead. ") + /// DEPRECATED: Use 'Resolution' instead. double? resolutionX; -/* DEPRECATED: Use 'Resolution' instead. */ - @Deprecated("Use 'Resolution' instead. ") + /// DEPRECATED: Use 'Resolution' instead. double? resolutionY; -/* The smallest width of the unit of BarCode bars or spaces. Increase this will increase the whole barcode image width. Ignored if AutoSizeMode property is set to AutoSizeMode.Nearest or AutoSizeMode.Interpolation. */ + /// The smallest width of the unit of BarCode bars or spaces. Increase this will increase the whole barcode image width. Ignored if AutoSizeMode property is set to AutoSizeMode.Nearest or AutoSizeMode.Interpolation. double? dimensionX; -/* Space between the CodeText and the BarCode in Unit value. Default value: 2pt. Ignored for EAN8, EAN13, UPCE, UPCA, ISBN, ISMN, ISSN, UpcaGs1DatabarCoupon. */ + /// Space between the CodeText and the BarCode in Unit value. Default value: 2pt. Ignored for EAN8, EAN13, UPCE, UPCA, ISBN, ISMN, ISSN, UpcaGs1DatabarCoupon. double? textSpace; -/* Common Units for all measuring in query. Default units: pixel. */ + /// Common Units for all measuring in query. Default units: pixel. AvailableGraphicsUnit? units; -/* Specifies the different types of automatic sizing modes. Default value: AutoSizeMode.None. */ + /// Specifies the different types of automatic sizing modes. Default value: AutoSizeMode.None. AutoSizeMode? sizeMode; -/* Height of the barcode in given units. Default units: pixel. */ + /// Height of the barcode in given units. Default units: pixel. double? barHeight; -/* Height of the barcode image in given units. Default units: pixel. */ + /// Height of the barcode image in given units. Default units: pixel. double? imageHeight; -/* Width of the barcode image in given units. Default units: pixel. */ + /// Width of the barcode image in given units. Default units: pixel. double? imageWidth; -/* BarCode image rotation angle, measured in degree, e.g. RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle NOT equal to 90, 180, 270 or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. */ + /// BarCode image rotation angle, measured in degree, e.g. RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle NOT equal to 90, 180, 270 or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. double? rotationAngle; -/* Barcode paddings. Default value: 5pt 5pt 5pt 5pt. */ + /// Barcode paddings. Default value: 5pt 5pt 5pt 5pt. Padding? padding; -/* Additional caption above barcode. */ + /// Additional caption above barcode. CaptionParams? captionAbove; -/* Additional caption below barcode. */ + /// Additional caption below barcode. CaptionParams? captionBelow; -/* Background color of the barcode image. Default value: Color.White. */ + /// Background color of the barcode image. Default value: Color.White. String? backColor; -/* Bars color. Default value: Color.Black. */ + /// Bars color. Default value: Color.Black. String? barColor; -/* Border color. Default value: Color.Black. */ + /// Border color. Default value: Color.Black. String? borderColor; -/* Border width. Default value: 0. Ignored if Visible is set to false. */ + /// Border width. Default value: 0. Ignored if Visible is set to false. double? borderWidth; -/* Border dash style. Default value: BorderDashStyle.Solid. */ + /// Border dash style. Default value: BorderDashStyle.Solid. BorderDashStyle? borderDashStyle; -/* Border visibility. If false than parameter Width is always ignored (0). Default value: false. */ + /// Border visibility. If false than parameter Width is always ignored (0). Default value: false. bool? borderVisible; -/* Enable checksum during generation 1D barcodes. Default is treated as Yes for symbology which must contain checksum, as No where checksum only possible. Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN, Codabar Checksum always used: Rest symbology */ + /// Enable checksum during generation 1D barcodes. Default is treated as Yes for symbology which must contain checksum, as No where checksum only possible. Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN, Codabar Checksum always used: Rest symbology EnableChecksum? enableChecksum; -/* Indicates whether explains the character \"\\\" as an escape character in CodeText property. Used for Pdf417, DataMatrix, Code128 only If the EnableEscape is true, \"\\\" will be explained as a special escape character. Otherwise, \"\\\" acts as normal characters. Aspose.BarCode supports input decimal ascii code and mnemonic for ASCII control-code characters. For example, \\013 and \\\\CR stands for CR. */ + /// Indicates whether explains the character \"\\\" as an escape character in CodeText property. Used for Pdf417, DataMatrix, Code128 only If the EnableEscape is true, \"\\\" will be explained as a special escape character. Otherwise, \"\\\" acts as normal characters. Aspose.BarCode supports input decimal ascii code and mnemonic for ASCII control-code characters. For example, \\013 and \\\\CR stands for CR. bool? enableEscape; -/* Value indicating whether bars are filled. Only for 1D barcodes. Default value: true. */ + /// Value indicating whether bars are filled. Only for 1D barcodes. Default value: true. bool? filledBars; -/* Always display checksum digit in the human readable text for Code128 and GS1Code128 barcodes. */ + /// Always display checksum digit in the human readable text for Code128 and GS1Code128 barcodes. bool? alwaysShowChecksum; -/* Wide bars to Narrow bars ratio. Default value: 3, that is, wide bars are 3 times as wide as narrow bars. Used for ITF, PZN, PharmaCode, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, IATA2of5, VIN, DeutschePost, OPC, Code32, DataLogic2of5, PatchCode, Code39Extended, Code39Standard */ + /// Wide bars to Narrow bars ratio. Default value: 3, that is, wide bars are 3 times as wide as narrow bars. Used for ITF, PZN, PharmaCode, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, IATA2of5, VIN, DeutschePost, OPC, Code32, DataLogic2of5, PatchCode, Code39Extended, Code39Standard double? wideNarrowRatio; -/* Only for 1D barcodes. If codetext is incorrect and value set to true - exception will be thrown. Otherwise codetext will be corrected to match barcode's specification. Exception always will be thrown for: Databar symbology if codetext is incorrect. Exception always will not be thrown for: AustraliaPost, SingaporePost, Code39Extended, Code93Extended, Code16K, Code128 symbology if codetext is incorrect. */ + /// Only for 1D barcodes. If codetext is incorrect and value set to true - exception will be thrown. Otherwise codetext will be corrected to match barcode's specification. Exception always will be thrown for: Databar symbology if codetext is incorrect. Exception always will not be thrown for: AustraliaPost, SingaporePost, Code39Extended, Code93Extended, Code16K, Code128 symbology if codetext is incorrect. bool? validateText; -/* Supplement parameters. Used for Interleaved2of5, Standard2of5, EAN13, EAN8, UPCA, UPCE, ISBN, ISSN, ISMN. */ + /// Supplement parameters. Used for Interleaved2of5, Standard2of5, EAN13, EAN8, UPCA, UPCE, ISBN, ISSN, ISMN. String? supplementData; -/* Space between main the BarCode and supplement BarCode. */ + /// Space between main the BarCode and supplement BarCode. double? supplementSpace; -/* Bars reduction value that is used to compensate ink spread while printing. */ + /// Bars reduction value that is used to compensate ink spread while printing. double? barWidthReduction; -/* Indicates whether is used anti-aliasing mode to render image. Anti-aliasing mode is applied to barcode and text drawing. */ + /// Indicates whether is used anti-aliasing mode to render image. Anti-aliasing mode is applied to barcode and text drawing. bool? useAntiAlias; -/* AustralianPost params. */ + /// AustralianPost params. AustralianPostParams? australianPost; -/* Aztec params. */ + /// Aztec params. AztecParams? aztec; -/* Codabar params. */ + /// Codabar params. CodabarParams? codabar; -/* Codablock params. */ + /// Codablock params. CodablockParams? codablock; -/* Code16K params. */ + /// Code16K params. Code16KParams? code16K; -/* Coupon params. */ + /// Coupon params. CouponParams? coupon; -/* DataBar params. */ + /// DataBar params. DataBarParams? dataBar; -/* DataMatrix params. */ + /// DataMatrix params. DataMatrixParams? dataMatrix; -/* DotCode params. */ + /// DotCode params. DotCodeParams? dotCode; -/* ITF params. */ + /// ITF params. ITFParams? ITF; -/* MaxiCode params. */ + /// MaxiCode params. MaxiCodeParams? maxiCode; -/* Pdf417 params. */ + /// Pdf417 params. Pdf417Params? pdf417; -/* Postal params. */ + /// Postal params. PostalParams? postal; -/* QR params. */ + /// QR params. QrParams? QR; -/* PatchCode params. */ + /// PatchCode params. PatchCodeParams? patchCode; -/* Code128 params. */ + /// Code128 params. Code128Params? code128; -/* HanXin params. */ + /// HanXin params. HanXinParams? hanXin; + /// Constructor GeneratorParams(); @override @@ -180,6 +180,7 @@ class GeneratorParams { return 'GeneratorParams[typeOfBarcode=$typeOfBarcode, text=$text, twoDDisplayText=$twoDDisplayText, textLocation=$textLocation, textAlignment=$textAlignment, textColor=$textColor, font=$font, fontSizeMode=$fontSizeMode, noWrap=$noWrap, resolution=$resolution, resolutionX=$resolutionX, resolutionY=$resolutionY, dimensionX=$dimensionX, textSpace=$textSpace, units=$units, sizeMode=$sizeMode, barHeight=$barHeight, imageHeight=$imageHeight, imageWidth=$imageWidth, rotationAngle=$rotationAngle, padding=$padding, captionAbove=$captionAbove, captionBelow=$captionBelow, backColor=$backColor, barColor=$barColor, borderColor=$borderColor, borderWidth=$borderWidth, borderDashStyle=$borderDashStyle, borderVisible=$borderVisible, enableChecksum=$enableChecksum, enableEscape=$enableEscape, filledBars=$filledBars, alwaysShowChecksum=$alwaysShowChecksum, wideNarrowRatio=$wideNarrowRatio, validateText=$validateText, supplementData=$supplementData, supplementSpace=$supplementSpace, barWidthReduction=$barWidthReduction, useAntiAlias=$useAntiAlias, australianPost=$australianPost, aztec=$aztec, codabar=$codabar, codablock=$codablock, code16K=$code16K, coupon=$coupon, dataBar=$dataBar, dataMatrix=$dataMatrix, dotCode=$dotCode, ITF=$ITF, maxiCode=$maxiCode, pdf417=$pdf417, postal=$postal, QR=$QR, patchCode=$patchCode, code128=$code128, hanXin=$hanXin, ]'; } + /// Creates a GeneratorParams instance from a JSON representation. GeneratorParams.fromJson(Map json) { typeOfBarcode = EncodeBarcodeType.fromJson(json['typeOfBarcode']); text = json['text']; @@ -239,6 +240,7 @@ class GeneratorParams { hanXin = HanXinParams.fromJson(json['hanXin']); } + /// Returns a JSON representation of GeneratorParams. Map toJson() { return { 'TypeOfBarcode': typeOfBarcode, @@ -300,17 +302,11 @@ class GeneratorParams { }; } + /// Converts a list of JSON objects to a list of GeneratorParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of GeneratorParams instances. static List listFromJson(List json) { return json.map((value) => GeneratorParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = GeneratorParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/generator_params_list.dart b/lib/src/model/generator_params_list.dart index d14aa10..98301d0 100644 --- a/lib/src/model/generator_params_list.dart +++ b/lib/src/model/generator_params_list.dart @@ -2,16 +2,18 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Represents list of barcode generators class GeneratorParamsList { - /* List of barcode generators */ + /// List of barcode generators List? barcodeBuilders = []; -/* Shift step according to X axis */ + /// Shift step according to X axis int? xStep; -/* Shift step according to Y axis */ + /// Shift step according to Y axis int? yStep; + /// Constructor GeneratorParamsList(); @override @@ -19,27 +21,23 @@ class GeneratorParamsList { return 'GeneratorParamsList[barcodeBuilders=$barcodeBuilders, xStep=$xStep, yStep=$yStep, ]'; } + /// Creates a GeneratorParamsList instance from a JSON representation. GeneratorParamsList.fromJson(Map json) { barcodeBuilders = GeneratorParams.listFromJson(json['barcodeBuilders']); xStep = json['xStep']; yStep = json['yStep']; } + /// Returns a JSON representation of GeneratorParamsList. Map toJson() { return {'BarcodeBuilders': barcodeBuilders, 'XStep': xStep, 'YStep': yStep}; } + /// Converts a list of JSON objects to a list of GeneratorParamsList instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of GeneratorParamsList instances. static List listFromJson(List json) { return json.map((value) => GeneratorParamsList.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = GeneratorParamsList.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/han_xin_encode_mode.dart b/lib/src/model/han_xin_encode_mode.dart index 48ff8de..097b1ac 100644 --- a/lib/src/model/han_xin_encode_mode.dart +++ b/lib/src/model/han_xin_encode_mode.dart @@ -1,8 +1,10 @@ +/// +/// HanXinEncodeMode: [Auto, Binary, ECI, Unicode, URI, Extended] class HanXinEncodeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of HanXinEncodeMode enum. + late final String _value; - HanXinEncodeMode._internal(this.value); + HanXinEncodeMode._internal(this._value); /// static HanXinEncodeMode auto_ = HanXinEncodeMode._internal("Auto"); @@ -22,44 +24,36 @@ class HanXinEncodeMode { /// static HanXinEncodeMode extended_ = HanXinEncodeMode._internal("Extended"); + /// Creates a HanXinEncodeMode instance from a JSON representation. HanXinEncodeMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Binary": - value = data; - break; case "ECI": - value = data; - break; case "Unicode": - value = data; - break; case "URI": - value = data; - break; case "Extended": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(HanXinEncodeMode data) { - return data.value; - } - + /// Returns a JSON representation of HanXinEncodeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of HanXinEncodeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of HanXinEncodeMode instances. static List listFromJson(List json) { return json.map((value) => HanXinEncodeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/han_xin_error_level.dart b/lib/src/model/han_xin_error_level.dart index b4ed864..74ae4f3 100644 --- a/lib/src/model/han_xin_error_level.dart +++ b/lib/src/model/han_xin_error_level.dart @@ -1,8 +1,10 @@ +/// +/// HanXinErrorLevel: [L1, L2, L3, L4] class HanXinErrorLevel { - /// The underlying value of this enum member. - String? value; + /// The underlying value of HanXinErrorLevel enum. + late final String _value; - HanXinErrorLevel._internal(this.value); + HanXinErrorLevel._internal(this._value); /// static HanXinErrorLevel l1_ = HanXinErrorLevel._internal("L1"); @@ -16,38 +18,34 @@ class HanXinErrorLevel { /// static HanXinErrorLevel l4_ = HanXinErrorLevel._internal("L4"); + /// Creates a HanXinErrorLevel instance from a JSON representation. HanXinErrorLevel.fromJson(dynamic data) { switch (data) { case "L1": - value = data; - break; case "L2": - value = data; - break; case "L3": - value = data; - break; case "L4": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(HanXinErrorLevel data) { - return data.value; - } - + /// Returns a JSON representation of HanXinErrorLevel. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of HanXinErrorLevel instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of HanXinErrorLevel instances. static List listFromJson(List json) { return json.map((value) => HanXinErrorLevel.fromJson(value)).toList(); } diff --git a/lib/src/model/han_xin_params.dart b/lib/src/model/han_xin_params.dart index b3e45ad..649b88c 100644 --- a/lib/src/model/han_xin_params.dart +++ b/lib/src/model/han_xin_params.dart @@ -2,19 +2,21 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// HanXin params. class HanXinParams { - /* Encoding mode for XanXin barcodes. Default value: HanXinEncodeMode.Auto. */ + /// Encoding mode for XanXin barcodes. Default value: HanXinEncodeMode.Auto. HanXinEncodeMode? encodeMode; -/* Allowed Han Xin error correction levels from L1 to L4. Default value: HanXinErrorLevel.L1. */ + /// Allowed Han Xin error correction levels from L1 to L4. Default value: HanXinErrorLevel.L1. HanXinErrorLevel? errorLevel; -/* Allowed Han Xin versions, Auto and Version01 - Version84. Default value: HanXinVersion.Auto. */ + /// Allowed Han Xin versions, Auto and Version01 - Version84. Default value: HanXinVersion.Auto. HanXinVersion? version; -/* Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details about the used references for encoding the data in the symbol. Current implementation consists all well known charset encodings. Default value: ECIEncodings.ISO_8859_1 */ + /// Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details about the used references for encoding the data in the symbol. Current implementation consists all well known charset encodings. Default value: ECIEncodings.ISO_8859_1 ECIEncodings? eCIEncoding; + /// Constructor HanXinParams(); @override @@ -22,6 +24,7 @@ class HanXinParams { return 'HanXinParams[encodeMode=$encodeMode, errorLevel=$errorLevel, version=$version, eCIEncoding=$eCIEncoding, ]'; } + /// Creates a HanXinParams instance from a JSON representation. HanXinParams.fromJson(Map json) { encodeMode = HanXinEncodeMode.fromJson(json['encodeMode']); errorLevel = HanXinErrorLevel.fromJson(json['errorLevel']); @@ -29,6 +32,7 @@ class HanXinParams { eCIEncoding = ECIEncodings.fromJson(json['eCIEncoding']); } + /// Returns a JSON representation of HanXinParams. Map toJson() { return { 'EncodeMode': encodeMode, @@ -38,17 +42,11 @@ class HanXinParams { }; } + /// Converts a list of JSON objects to a list of HanXinParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of HanXinParams instances. static List listFromJson(List json) { return json.map((value) => HanXinParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = HanXinParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/han_xin_version.dart b/lib/src/model/han_xin_version.dart index 7238247..d61f561 100644 --- a/lib/src/model/han_xin_version.dart +++ b/lib/src/model/han_xin_version.dart @@ -1,8 +1,10 @@ +/// +/// HanXinVersion: [Auto, Version01, Version02, Version03, Version04, Version05, Version06, Version07, Version08, Version09, Version10, Version11, Version12, Version13, Version14, Version15, Version16, Version17, Version18, Version19, Version20, Version21, Version22, Version23, Version24, Version25, Version26, Version27, Version28, Version29, Version30, Version31, Version32, Version33, Version34, Version35, Version36, Version37, Version38, Version39, Version40, Version41, Version42, Version43, Version44, Version45, Version46, Version47, Version48, Version49, Version50, Version51, Version52, Version53, Version54, Version55, Version56, Version57, Version58, Version59, Version60, Version61, Version62, Version63, Version64, Version65, Version66, Version67, Version68, Version69, Version70, Version71, Version72, Version73, Version74, Version75, Version76, Version77, Version78, Version79, Version80, Version81, Version82, Version83, Version84] class HanXinVersion { - /// The underlying value of this enum member. - String? value; + /// The underlying value of HanXinVersion enum. + late final String _value; - HanXinVersion._internal(this.value); + HanXinVersion._internal(this._value); /// static HanXinVersion auto_ = HanXinVersion._internal("Auto"); @@ -259,281 +261,115 @@ class HanXinVersion { /// static HanXinVersion version84_ = HanXinVersion._internal("Version84"); + /// Creates a HanXinVersion instance from a JSON representation. HanXinVersion.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Version01": - value = data; - break; case "Version02": - value = data; - break; case "Version03": - value = data; - break; case "Version04": - value = data; - break; case "Version05": - value = data; - break; case "Version06": - value = data; - break; case "Version07": - value = data; - break; case "Version08": - value = data; - break; case "Version09": - value = data; - break; case "Version10": - value = data; - break; case "Version11": - value = data; - break; case "Version12": - value = data; - break; case "Version13": - value = data; - break; case "Version14": - value = data; - break; case "Version15": - value = data; - break; case "Version16": - value = data; - break; case "Version17": - value = data; - break; case "Version18": - value = data; - break; case "Version19": - value = data; - break; case "Version20": - value = data; - break; case "Version21": - value = data; - break; case "Version22": - value = data; - break; case "Version23": - value = data; - break; case "Version24": - value = data; - break; case "Version25": - value = data; - break; case "Version26": - value = data; - break; case "Version27": - value = data; - break; case "Version28": - value = data; - break; case "Version29": - value = data; - break; case "Version30": - value = data; - break; case "Version31": - value = data; - break; case "Version32": - value = data; - break; case "Version33": - value = data; - break; case "Version34": - value = data; - break; case "Version35": - value = data; - break; case "Version36": - value = data; - break; case "Version37": - value = data; - break; case "Version38": - value = data; - break; case "Version39": - value = data; - break; case "Version40": - value = data; - break; case "Version41": - value = data; - break; case "Version42": - value = data; - break; case "Version43": - value = data; - break; case "Version44": - value = data; - break; case "Version45": - value = data; - break; case "Version46": - value = data; - break; case "Version47": - value = data; - break; case "Version48": - value = data; - break; case "Version49": - value = data; - break; case "Version50": - value = data; - break; case "Version51": - value = data; - break; case "Version52": - value = data; - break; case "Version53": - value = data; - break; case "Version54": - value = data; - break; case "Version55": - value = data; - break; case "Version56": - value = data; - break; case "Version57": - value = data; - break; case "Version58": - value = data; - break; case "Version59": - value = data; - break; case "Version60": - value = data; - break; case "Version61": - value = data; - break; case "Version62": - value = data; - break; case "Version63": - value = data; - break; case "Version64": - value = data; - break; case "Version65": - value = data; - break; case "Version66": - value = data; - break; case "Version67": - value = data; - break; case "Version68": - value = data; - break; case "Version69": - value = data; - break; case "Version70": - value = data; - break; case "Version71": - value = data; - break; case "Version72": - value = data; - break; case "Version73": - value = data; - break; case "Version74": - value = data; - break; case "Version75": - value = data; - break; case "Version76": - value = data; - break; case "Version77": - value = data; - break; case "Version78": - value = data; - break; case "Version79": - value = data; - break; case "Version80": - value = data; - break; case "Version81": - value = data; - break; case "Version82": - value = data; - break; case "Version83": - value = data; - break; case "Version84": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(HanXinVersion data) { - return data.value; - } - + /// Returns a JSON representation of HanXinVersion. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of HanXinVersion instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of HanXinVersion instances. static List listFromJson(List json) { return json.map((value) => HanXinVersion.fromJson(value)).toList(); } diff --git a/lib/src/model/itf14_border_type.dart b/lib/src/model/itf14_border_type.dart index a189d47..fbbfc55 100644 --- a/lib/src/model/itf14_border_type.dart +++ b/lib/src/model/itf14_border_type.dart @@ -1,8 +1,10 @@ +/// +/// ITF14BorderType: [None, Frame, Bar, FrameOut, BarOut] class ITF14BorderType { - /// The underlying value of this enum member. - String? value; + /// The underlying value of ITF14BorderType enum. + late final String _value; - ITF14BorderType._internal(this.value); + ITF14BorderType._internal(this._value); /// static ITF14BorderType none_ = ITF14BorderType._internal("None"); @@ -19,41 +21,35 @@ class ITF14BorderType { /// static ITF14BorderType barOut_ = ITF14BorderType._internal("BarOut"); + /// Creates a ITF14BorderType instance from a JSON representation. ITF14BorderType.fromJson(dynamic data) { switch (data) { case "None": - value = data; - break; case "Frame": - value = data; - break; case "Bar": - value = data; - break; case "FrameOut": - value = data; - break; case "BarOut": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(ITF14BorderType data) { - return data.value; - } - + /// Returns a JSON representation of ITF14BorderType. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of ITF14BorderType instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ITF14BorderType instances. static List listFromJson(List json) { return json.map((value) => ITF14BorderType.fromJson(value)).toList(); } diff --git a/lib/src/model/itf_params.dart b/lib/src/model/itf_params.dart index b271060..53dc957 100644 --- a/lib/src/model/itf_params.dart +++ b/lib/src/model/itf_params.dart @@ -2,16 +2,18 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// ITF parameters. class ITFParams { - /* ITF border (bearer bar) thickness in Unit value. Default value: 12pt. */ + /// ITF border (bearer bar) thickness in Unit value. Default value: 12pt. double? borderThickness; -/* Border type of ITF barcode. Default value: ITF14BorderType.Bar. */ + /// Border type of ITF barcode. Default value: ITF14BorderType.Bar. ITF14BorderType? borderType; -/* Size of the quiet zones in xDimension. Default value: 10, meaning if xDimension = 2px than quiet zones will be 20px. */ + /// Size of the quiet zones in xDimension. Default value: 10, meaning if xDimension = 2px than quiet zones will be 20px. int? quietZoneCoef; + /// Constructor ITFParams(); @override @@ -19,12 +21,14 @@ class ITFParams { return 'ITFParams[borderThickness=$borderThickness, borderType=$borderType, quietZoneCoef=$quietZoneCoef, ]'; } + /// Creates a ITFParams instance from a JSON representation. ITFParams.fromJson(Map json) { borderThickness = json['borderThickness']?.toDouble(); borderType = ITF14BorderType.fromJson(json['borderType']); quietZoneCoef = json['quietZoneCoef']; } + /// Returns a JSON representation of ITFParams. Map toJson() { return { 'BorderThickness': borderThickness, @@ -33,17 +37,11 @@ class ITFParams { }; } + /// Converts a list of JSON objects to a list of ITFParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ITFParams instances. static List listFromJson(List json) { return json.map((value) => ITFParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = ITFParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/macro_character.dart b/lib/src/model/macro_character.dart index 39684e1..ee37d00 100644 --- a/lib/src/model/macro_character.dart +++ b/lib/src/model/macro_character.dart @@ -1,8 +1,10 @@ +/// +/// MacroCharacter: [None, Macro05, Macro06] class MacroCharacter { - /// The underlying value of this enum member. - String? value; + /// The underlying value of MacroCharacter enum. + late final String _value; - MacroCharacter._internal(this.value); + MacroCharacter._internal(this._value); /// static MacroCharacter none_ = MacroCharacter._internal("None"); @@ -13,35 +15,33 @@ class MacroCharacter { /// static MacroCharacter macro06_ = MacroCharacter._internal("Macro06"); + /// Creates a MacroCharacter instance from a JSON representation. MacroCharacter.fromJson(dynamic data) { switch (data) { case "None": - value = data; - break; case "Macro05": - value = data; - break; case "Macro06": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(MacroCharacter data) { - return data.value; - } - + /// Returns a JSON representation of MacroCharacter. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of MacroCharacter instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of MacroCharacter instances. static List listFromJson(List json) { return json.map((value) => MacroCharacter.fromJson(value)).toList(); } diff --git a/lib/src/model/maxi_code_encode_mode.dart b/lib/src/model/maxi_code_encode_mode.dart index 2be9d8a..dc9e97b 100644 --- a/lib/src/model/maxi_code_encode_mode.dart +++ b/lib/src/model/maxi_code_encode_mode.dart @@ -1,8 +1,10 @@ +/// +/// MaxiCodeEncodeMode: [Auto, Bytes, ExtendedCodetext] class MaxiCodeEncodeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of MaxiCodeEncodeMode enum. + late final String _value; - MaxiCodeEncodeMode._internal(this.value); + MaxiCodeEncodeMode._internal(this._value); /// static MaxiCodeEncodeMode auto_ = MaxiCodeEncodeMode._internal("Auto"); @@ -14,35 +16,33 @@ class MaxiCodeEncodeMode { static MaxiCodeEncodeMode extendedCodetext_ = MaxiCodeEncodeMode._internal("ExtendedCodetext"); + /// Creates a MaxiCodeEncodeMode instance from a JSON representation. MaxiCodeEncodeMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Bytes": - value = data; - break; case "ExtendedCodetext": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(MaxiCodeEncodeMode data) { - return data.value; - } - + /// Returns a JSON representation of MaxiCodeEncodeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of MaxiCodeEncodeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of MaxiCodeEncodeMode instances. static List listFromJson(List json) { return json.map((value) => MaxiCodeEncodeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/maxi_code_mode.dart b/lib/src/model/maxi_code_mode.dart index db7ad71..979963a 100644 --- a/lib/src/model/maxi_code_mode.dart +++ b/lib/src/model/maxi_code_mode.dart @@ -1,8 +1,10 @@ +/// +/// MaxiCodeMode: [Mode2, Mode3, Mode4, Mode5, Mode6] class MaxiCodeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of MaxiCodeMode enum. + late final String _value; - MaxiCodeMode._internal(this.value); + MaxiCodeMode._internal(this._value); /// static MaxiCodeMode mode2_ = MaxiCodeMode._internal("Mode2"); @@ -19,41 +21,35 @@ class MaxiCodeMode { /// static MaxiCodeMode mode6_ = MaxiCodeMode._internal("Mode6"); + /// Creates a MaxiCodeMode instance from a JSON representation. MaxiCodeMode.fromJson(dynamic data) { switch (data) { case "Mode2": - value = data; - break; case "Mode3": - value = data; - break; case "Mode4": - value = data; - break; case "Mode5": - value = data; - break; case "Mode6": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(MaxiCodeMode data) { - return data.value; - } - + /// Returns a JSON representation of MaxiCodeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of MaxiCodeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of MaxiCodeMode instances. static List listFromJson(List json) { return json.map((value) => MaxiCodeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/maxi_code_params.dart b/lib/src/model/maxi_code_params.dart index 2f82962..8b4f8d7 100644 --- a/lib/src/model/maxi_code_params.dart +++ b/lib/src/model/maxi_code_params.dart @@ -2,16 +2,18 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// MaxiCode parameters. class MaxiCodeParams { - /* Height/Width ratio of 2D BarCode module. */ + /// Height/Width ratio of 2D BarCode module. double? aspectRatio; -/* Mode for MaxiCode barcodes. */ + /// Mode for MaxiCode barcodes. MaxiCodeMode? mode; -/* Encoding mode for MaxiCode barcodes. */ + /// Encoding mode for MaxiCode barcodes. MaxiCodeEncodeMode? encodeMode; + /// Constructor MaxiCodeParams(); @override @@ -19,27 +21,23 @@ class MaxiCodeParams { return 'MaxiCodeParams[aspectRatio=$aspectRatio, mode=$mode, encodeMode=$encodeMode, ]'; } + /// Creates a MaxiCodeParams instance from a JSON representation. MaxiCodeParams.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); mode = MaxiCodeMode.fromJson(json['mode']); encodeMode = MaxiCodeEncodeMode.fromJson(json['encodeMode']); } + /// Returns a JSON representation of MaxiCodeParams. Map toJson() { return {'AspectRatio': aspectRatio, 'Mode': mode, 'EncodeMode': encodeMode}; } + /// Converts a list of JSON objects to a list of MaxiCodeParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of MaxiCodeParams instances. static List listFromJson(List json) { return json.map((value) => MaxiCodeParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = MaxiCodeParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/object_exist.dart b/lib/src/model/object_exist.dart index 88898b7..0b35fdb 100644 --- a/lib/src/model/object_exist.dart +++ b/lib/src/model/object_exist.dart @@ -1,13 +1,15 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Object exists class ObjectExist { - /* Indicates that the file or folder exists. */ + /// Indicates that the file or folder exists. bool? exists; -/* True if it is a folder, false if it is a file. */ + /// True if it is a folder, false if it is a file. bool? isFolder; + /// Constructor ObjectExist(); @override @@ -15,26 +17,22 @@ class ObjectExist { return 'ObjectExist[exists=$exists, isFolder=$isFolder, ]'; } + /// Creates a ObjectExist instance from a JSON representation. ObjectExist.fromJson(Map json) { exists = json['exists']; isFolder = json['isFolder']; } + /// Returns a JSON representation of ObjectExist. Map toJson() { return {'Exists': exists, 'IsFolder': isFolder}; } + /// Converts a list of JSON objects to a list of ObjectExist instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ObjectExist instances. static List listFromJson(List json) { return json.map((value) => ObjectExist.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = ObjectExist.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/padding.dart b/lib/src/model/padding.dart index 63d0b42..b036a2f 100644 --- a/lib/src/model/padding.dart +++ b/lib/src/model/padding.dart @@ -1,19 +1,21 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Padding around barcode. class Padding { - /* Left padding. */ + /// Left padding. double? left; -/* Right padding. */ + /// Right padding. double? right; -/* Top padding. */ + /// Top padding. double? top; -/* Bottom padding. */ + /// Bottom padding. double? bottom; + /// Constructor Padding(); @override @@ -21,6 +23,7 @@ class Padding { return 'Padding[left=$left, right=$right, top=$top, bottom=$bottom, ]'; } + /// Creates a Padding instance from a JSON representation. Padding.fromJson(Map json) { left = json['left']?.toDouble(); right = json['right']?.toDouble(); @@ -28,21 +31,16 @@ class Padding { bottom = json['bottom']?.toDouble(); } + /// Returns a JSON representation of Padding. Map toJson() { return {'Left': left, 'Right': right, 'Top': top, 'Bottom': bottom}; } + /// Converts a list of JSON objects to a list of Padding instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Padding instances. static List listFromJson(List json) { return json.map((value) => Padding.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = Padding.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/patch_code_params.dart b/lib/src/model/patch_code_params.dart index a75484d..49a3285 100644 --- a/lib/src/model/patch_code_params.dart +++ b/lib/src/model/patch_code_params.dart @@ -2,13 +2,15 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// PatchCode parameters. class PatchCodeParams { - /* Specifies codetext for an extra QR barcode, when PatchCode is generated in page mode. */ + /// Specifies codetext for an extra QR barcode, when PatchCode is generated in page mode. String? extraBarcodeText; -/* PatchCode format. Choose PatchOnly to generate single PatchCode. Use page format to generate Patch page with PatchCodes as borders. Default value: PatchFormat.PatchOnly */ + /// PatchCode format. Choose PatchOnly to generate single PatchCode. Use page format to generate Patch page with PatchCodes as borders. Default value: PatchFormat.PatchOnly PatchFormat? patchFormat; + /// Constructor PatchCodeParams(); @override @@ -16,26 +18,22 @@ class PatchCodeParams { return 'PatchCodeParams[extraBarcodeText=$extraBarcodeText, patchFormat=$patchFormat, ]'; } + /// Creates a PatchCodeParams instance from a JSON representation. PatchCodeParams.fromJson(Map json) { extraBarcodeText = json['extraBarcodeText']; patchFormat = PatchFormat.fromJson(json['patchFormat']); } + /// Returns a JSON representation of PatchCodeParams. Map toJson() { return {'ExtraBarcodeText': extraBarcodeText, 'PatchFormat': patchFormat}; } + /// Converts a list of JSON objects to a list of PatchCodeParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of PatchCodeParams instances. static List listFromJson(List json) { return json.map((value) => PatchCodeParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = PatchCodeParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/patch_format.dart b/lib/src/model/patch_format.dart index 233db7a..d03f974 100644 --- a/lib/src/model/patch_format.dart +++ b/lib/src/model/patch_format.dart @@ -1,8 +1,10 @@ +/// +/// PatchFormat: [PatchOnly, A4, A4_LANDSCAPE, US_Letter, US_Letter_LANDSCAPE] class PatchFormat { - /// The underlying value of this enum member. - String? value; + /// The underlying value of PatchFormat enum. + late final String _value; - PatchFormat._internal(this.value); + PatchFormat._internal(this._value); /// static PatchFormat patchOnly_ = PatchFormat._internal("PatchOnly"); @@ -20,41 +22,35 @@ class PatchFormat { static PatchFormat uSLetterLANDSCAPE_ = PatchFormat._internal("US_Letter_LANDSCAPE"); + /// Creates a PatchFormat instance from a JSON representation. PatchFormat.fromJson(dynamic data) { switch (data) { case "PatchOnly": - value = data; - break; case "A4": - value = data; - break; case "A4_LANDSCAPE": - value = data; - break; case "US_Letter": - value = data; - break; case "US_Letter_LANDSCAPE": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(PatchFormat data) { - return data.value; - } - + /// Returns a JSON representation of PatchFormat. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of PatchFormat instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of PatchFormat instances. static List listFromJson(List json) { return json.map((value) => PatchFormat.fromJson(value)).toList(); } diff --git a/lib/src/model/pdf417_compaction_mode.dart b/lib/src/model/pdf417_compaction_mode.dart index a602a3d..cce9aca 100644 --- a/lib/src/model/pdf417_compaction_mode.dart +++ b/lib/src/model/pdf417_compaction_mode.dart @@ -1,8 +1,10 @@ +/// +/// Pdf417CompactionMode: [Auto, Text, Numeric, Binary] class Pdf417CompactionMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of Pdf417CompactionMode enum. + late final String _value; - Pdf417CompactionMode._internal(this.value); + Pdf417CompactionMode._internal(this._value); /// static Pdf417CompactionMode auto_ = Pdf417CompactionMode._internal("Auto"); @@ -18,38 +20,34 @@ class Pdf417CompactionMode { static Pdf417CompactionMode binary_ = Pdf417CompactionMode._internal("Binary"); + /// Creates a Pdf417CompactionMode instance from a JSON representation. Pdf417CompactionMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Text": - value = data; - break; case "Numeric": - value = data; - break; case "Binary": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(Pdf417CompactionMode data) { - return data.value; - } - + /// Returns a JSON representation of Pdf417CompactionMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of Pdf417CompactionMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Pdf417CompactionMode instances. static List listFromJson(List json) { return json.map((value) => Pdf417CompactionMode.fromJson(value)).toList(); } diff --git a/lib/src/model/pdf417_error_level.dart b/lib/src/model/pdf417_error_level.dart index 95442ee..de6ad33 100644 --- a/lib/src/model/pdf417_error_level.dart +++ b/lib/src/model/pdf417_error_level.dart @@ -1,8 +1,10 @@ +/// +/// Pdf417ErrorLevel: [Level0, Level1, Level2, Level3, Level4, Level5, Level6, Level7, Level8] class Pdf417ErrorLevel { - /// The underlying value of this enum member. - String? value; + /// The underlying value of Pdf417ErrorLevel enum. + late final String _value; - Pdf417ErrorLevel._internal(this.value); + Pdf417ErrorLevel._internal(this._value); /// static Pdf417ErrorLevel level0_ = Pdf417ErrorLevel._internal("Level0"); @@ -31,53 +33,39 @@ class Pdf417ErrorLevel { /// static Pdf417ErrorLevel level8_ = Pdf417ErrorLevel._internal("Level8"); + /// Creates a Pdf417ErrorLevel instance from a JSON representation. Pdf417ErrorLevel.fromJson(dynamic data) { switch (data) { case "Level0": - value = data; - break; case "Level1": - value = data; - break; case "Level2": - value = data; - break; case "Level3": - value = data; - break; case "Level4": - value = data; - break; case "Level5": - value = data; - break; case "Level6": - value = data; - break; case "Level7": - value = data; - break; case "Level8": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(Pdf417ErrorLevel data) { - return data.value; - } - + /// Returns a JSON representation of Pdf417ErrorLevel. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of Pdf417ErrorLevel instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Pdf417ErrorLevel instances. static List listFromJson(List json) { return json.map((value) => Pdf417ErrorLevel.fromJson(value)).toList(); } diff --git a/lib/src/model/pdf417_macro_terminator.dart b/lib/src/model/pdf417_macro_terminator.dart index eedb210..d1bb166 100644 --- a/lib/src/model/pdf417_macro_terminator.dart +++ b/lib/src/model/pdf417_macro_terminator.dart @@ -1,8 +1,10 @@ +/// +/// Pdf417MacroTerminator: [Auto, None, Set] class Pdf417MacroTerminator { - /// The underlying value of this enum member. - String? value; + /// The underlying value of Pdf417MacroTerminator enum. + late final String _value; - Pdf417MacroTerminator._internal(this.value); + Pdf417MacroTerminator._internal(this._value); /// static Pdf417MacroTerminator auto_ = Pdf417MacroTerminator._internal("Auto"); @@ -13,35 +15,33 @@ class Pdf417MacroTerminator { /// static Pdf417MacroTerminator set_ = Pdf417MacroTerminator._internal("Set"); + /// Creates a Pdf417MacroTerminator instance from a JSON representation. Pdf417MacroTerminator.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "None": - value = data; - break; case "Set": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(Pdf417MacroTerminator data) { - return data.value; - } - + /// Returns a JSON representation of Pdf417MacroTerminator. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of Pdf417MacroTerminator instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Pdf417MacroTerminator instances. static List listFromJson(List json) { return json.map((value) => Pdf417MacroTerminator.fromJson(value)).toList(); } diff --git a/lib/src/model/pdf417_params.dart b/lib/src/model/pdf417_params.dart index 4a32ecb..c9c645e 100644 --- a/lib/src/model/pdf417_params.dart +++ b/lib/src/model/pdf417_params.dart @@ -2,83 +2,81 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// PDF417 parameters. class Pdf417Params { - /* Height/Width ratio of 2D BarCode module. */ + /// Height/Width ratio of 2D BarCode module. double? aspectRatio; -/* DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. */ - @Deprecated( - "This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. ") + /// DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. String? textEncoding; -/* Columns count. */ + /// Columns count. int? columns; -/* Pdf417 symbology type of BarCode's compaction mode. Default value: Pdf417CompactionMode.Auto. */ + /// Pdf417 symbology type of BarCode's compaction mode. Default value: Pdf417CompactionMode.Auto. Pdf417CompactionMode? compactionMode; -/* Pdf417 symbology type of BarCode's error correction level ranging from level0 to level8, level0 means no error correction info, level8 means best error correction which means a larger picture. */ + /// Pdf417 symbology type of BarCode's error correction level ranging from level0 to level8, level0 means no error correction info, level8 means best error correction which means a larger picture. Pdf417ErrorLevel? errorLevel; -/* Macro Pdf417 barcode's file ID. Used for MacroPdf417. */ + /// Macro Pdf417 barcode's file ID. Used for MacroPdf417. int? macroFileID; -/* Macro Pdf417 barcode's segment ID, which starts from 0, to MacroSegmentsCount - 1. */ + /// Macro Pdf417 barcode's segment ID, which starts from 0, to MacroSegmentsCount - 1. int? macroSegmentID; -/* Macro Pdf417 barcode segments count. */ + /// Macro Pdf417 barcode segments count. int? macroSegmentsCount; -/* Rows count. */ + /// Rows count. int? rows; -/* Whether Pdf417 symbology type of BarCode is truncated (to reduce space). */ + /// Whether Pdf417 symbology type of BarCode is truncated (to reduce space). bool? truncate; -/* Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details about the used references for encoding the data in the symbol. Current implementation consists all well known charset encodings. */ + /// Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details about the used references for encoding the data in the symbol. Current implementation consists all well known charset encodings. ECIEncodings? pdf417ECIEncoding; -/* Used to instruct the reader to interpret the data contained within the symbol as programming for reader initialization */ + /// Used to instruct the reader to interpret the data contained within the symbol as programming for reader initialization bool? isReaderInitialization; -/* Macro Pdf417 barcode time stamp */ + /// Macro Pdf417 barcode time stamp DateTime? macroTimeStamp; -/* Macro Pdf417 barcode sender name */ + /// Macro Pdf417 barcode sender name String? macroSender; -/* Macro Pdf417 file size. The file size field contains the size in bytes of the entire source file */ + /// Macro Pdf417 file size. The file size field contains the size in bytes of the entire source file int? macroFileSize; -/* Macro Pdf417 barcode checksum. The checksum field contains the value of the 16-bit (2 bytes) CRC checksum using the CCITT-16 polynomial */ + /// Macro Pdf417 barcode checksum. The checksum field contains the value of the 16-bit (2 bytes) CRC checksum using the CCITT-16 polynomial int? macroChecksum; -/* Macro Pdf417 barcode file name */ + /// Macro Pdf417 barcode file name String? macroFileName; -/* Macro Pdf417 barcode addressee name */ + /// Macro Pdf417 barcode addressee name String? macroAddressee; -/* Extended Channel Interpretation Identifiers. Applies for Macro PDF417 text fields. */ + /// Extended Channel Interpretation Identifiers. Applies for Macro PDF417 text fields. ECIEncodings? macroECIEncoding; -/* DEPRECATED: This property is obsolete and will be removed in future releases. See samples of using new parameters on https://releases.aspose.com/barcode/net/release-notes/2023/aspose-barcode-for-net-23-10-release-notes/ Function codeword for Code 128 emulation. Applied for MicroPDF417 only. Ignored for PDF417 and MacroPDF417 barcodes. */ - @Deprecated( - "This property is obsolete and will be removed in future releases. See samples of using new parameters on https://releases.aspose.com/barcode/net/release-notes/2023/aspose-barcode-for-net-23-10-release-notes/ Function codeword for Code 128 emulation. Applied for MicroPDF417 only. Ignored for PDF417 and MacroPDF417 barcodes. ") + /// DEPRECATED: This property is obsolete and will be removed in future releases. See samples of using new parameters on https://releases.aspose.com/barcode/net/release-notes/2023/aspose-barcode-for-net-23-10-release-notes/ Function codeword for Code 128 emulation. Applied for MicroPDF417 only. Ignored for PDF417 and MacroPDF417 barcodes. Code128Emulation? code128Emulation; -/* Can be used only with MicroPdf417 and encodes Code 128 emulation modes. Can encode FNC1 in second position modes 908 and 909, also can encode 910 and 911 which just indicate that recognized MicroPdf417 can be interpret as Code 128. */ + /// Can be used only with MicroPdf417 and encodes Code 128 emulation modes. Can encode FNC1 in second position modes 908 and 909, also can encode 910 and 911 which just indicate that recognized MicroPdf417 can be interpret as Code 128. bool? isCode128Emulation; -/* Used to tell the encoder whether to add Macro PDF417 Terminator (codeword 922) to the segment. Applied only for Macro PDF417. */ + /// Used to tell the encoder whether to add Macro PDF417 Terminator (codeword 922) to the segment. Applied only for Macro PDF417. Pdf417MacroTerminator? pdf417MacroTerminator; -/* Defines linked modes with GS1MicroPdf417, MicroPdf417 and Pdf417 barcodes. With GS1MicroPdf417 symbology encodes 906, 907, 912, 913, 914, 915 “Linked” UCC/EAN-128 modes. With MicroPdf417 and Pdf417 symbologies encodes 918 linkage flag to associated linear component other than an EAN.UCC. */ + /// Defines linked modes with GS1MicroPdf417, MicroPdf417 and Pdf417 barcodes. With GS1MicroPdf417 symbology encodes 906, 907, 912, 913, 914, 915 “Linked” UCC/EAN-128 modes. With MicroPdf417 and Pdf417 symbologies encodes 918 linkage flag to associated linear component other than an EAN.UCC. bool? isLinked; -/* Macro Characters 05 and 06 values are used to obtain more compact encoding in special modes. Can be used only with MicroPdf417 and encodes 916 and 917 MicroPdf417 modes. Default value: MacroCharacters.None. */ + /// Macro Characters 05 and 06 values are used to obtain more compact encoding in special modes. Can be used only with MicroPdf417 and encodes 916 and 917 MicroPdf417 modes. Default value: MacroCharacters.None. MacroCharacter? macroCharacters; + /// Constructor Pdf417Params(); @override @@ -86,6 +84,7 @@ class Pdf417Params { return 'Pdf417Params[aspectRatio=$aspectRatio, textEncoding=$textEncoding, columns=$columns, compactionMode=$compactionMode, errorLevel=$errorLevel, macroFileID=$macroFileID, macroSegmentID=$macroSegmentID, macroSegmentsCount=$macroSegmentsCount, rows=$rows, truncate=$truncate, pdf417ECIEncoding=$pdf417ECIEncoding, isReaderInitialization=$isReaderInitialization, macroTimeStamp=$macroTimeStamp, macroSender=$macroSender, macroFileSize=$macroFileSize, macroChecksum=$macroChecksum, macroFileName=$macroFileName, macroAddressee=$macroAddressee, macroECIEncoding=$macroECIEncoding, code128Emulation=$code128Emulation, isCode128Emulation=$isCode128Emulation, pdf417MacroTerminator=$pdf417MacroTerminator, isLinked=$isLinked, macroCharacters=$macroCharacters, ]'; } + /// Creates a Pdf417Params instance from a JSON representation. Pdf417Params.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); textEncoding = json['textEncoding']; @@ -116,6 +115,7 @@ class Pdf417Params { macroCharacters = MacroCharacter.fromJson(json['macroCharacters']); } + /// Returns a JSON representation of Pdf417Params. Map toJson() { return { 'AspectRatio': aspectRatio, @@ -147,17 +147,11 @@ class Pdf417Params { }; } + /// Converts a list of JSON objects to a list of Pdf417Params instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of Pdf417Params instances. static List listFromJson(List json) { return json.map((value) => Pdf417Params.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = Pdf417Params.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/postal_params.dart b/lib/src/model/postal_params.dart index 947c3ef..809e31b 100644 --- a/lib/src/model/postal_params.dart +++ b/lib/src/model/postal_params.dart @@ -1,10 +1,12 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Postal parameters. Used for Postnet, Planet. class PostalParams { - /* Short bar's height of Postal barcodes. */ + /// Short bar's height of Postal barcodes. double? shortBarHeight; + /// Constructor PostalParams(); @override @@ -12,25 +14,21 @@ class PostalParams { return 'PostalParams[shortBarHeight=$shortBarHeight, ]'; } + /// Creates a PostalParams instance from a JSON representation. PostalParams.fromJson(Map json) { shortBarHeight = json['shortBarHeight']?.toDouble(); } + /// Returns a JSON representation of PostalParams. Map toJson() { return {'ShortBarHeight': shortBarHeight}; } + /// Converts a list of JSON objects to a list of PostalParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of PostalParams instances. static List listFromJson(List json) { return json.map((value) => PostalParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = PostalParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/preset_type.dart b/lib/src/model/preset_type.dart index b544adf..e197046 100644 --- a/lib/src/model/preset_type.dart +++ b/lib/src/model/preset_type.dart @@ -1,8 +1,10 @@ +/// See QualitySettings allows to configure recognition quality and speed manually. +/// PresetType: [HighPerformance, NormalQuality, HighQualityDetection, MaxQualityDetection, HighQuality, MaxBarCodes] class PresetType { - /// The underlying value of this enum member. - String? value; + /// The underlying value of PresetType enum. + late final String _value; - PresetType._internal(this.value); + PresetType._internal(this._value); /// See QualitySettings allows to configure recognition quality and speed manually. static PresetType highPerformance_ = PresetType._internal("HighPerformance"); @@ -24,44 +26,36 @@ class PresetType { /// See QualitySettings allows to configure recognition quality and speed manually. static PresetType maxBarCodes_ = PresetType._internal("MaxBarCodes"); + /// Creates a PresetType instance from a JSON representation. PresetType.fromJson(dynamic data) { switch (data) { case "HighPerformance": - value = data; - break; case "NormalQuality": - value = data; - break; case "HighQualityDetection": - value = data; - break; case "MaxQualityDetection": - value = data; - break; case "HighQuality": - value = data; - break; case "MaxBarCodes": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(PresetType data) { - return data.value; - } - + /// Returns a JSON representation of PresetType. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of PresetType instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of PresetType instances. static List listFromJson(List json) { return json.map((value) => PresetType.fromJson(value)).toList(); } diff --git a/lib/src/model/qr_encode_mode.dart b/lib/src/model/qr_encode_mode.dart index f422781..8227aec 100644 --- a/lib/src/model/qr_encode_mode.dart +++ b/lib/src/model/qr_encode_mode.dart @@ -1,8 +1,10 @@ +/// +/// QREncodeMode: [Auto, Bytes, Utf8BOM, Utf16BEBOM, ECIEncoding, ExtendedCodetext] class QREncodeMode { - /// The underlying value of this enum member. - String? value; + /// The underlying value of QREncodeMode enum. + late final String _value; - QREncodeMode._internal(this.value); + QREncodeMode._internal(this._value); /// static QREncodeMode auto_ = QREncodeMode._internal("Auto"); @@ -23,44 +25,36 @@ class QREncodeMode { static QREncodeMode extendedCodetext_ = QREncodeMode._internal("ExtendedCodetext"); + /// Creates a QREncodeMode instance from a JSON representation. QREncodeMode.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Bytes": - value = data; - break; case "Utf8BOM": - value = data; - break; case "Utf16BEBOM": - value = data; - break; case "ECIEncoding": - value = data; - break; case "ExtendedCodetext": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(QREncodeMode data) { - return data.value; - } - + /// Returns a JSON representation of QREncodeMode. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of QREncodeMode instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of QREncodeMode instances. static List listFromJson(List json) { return json.map((value) => QREncodeMode.fromJson(value)).toList(); } diff --git a/lib/src/model/qr_encode_type.dart b/lib/src/model/qr_encode_type.dart index 58509cb..865e27f 100644 --- a/lib/src/model/qr_encode_type.dart +++ b/lib/src/model/qr_encode_type.dart @@ -1,8 +1,10 @@ +/// +/// QREncodeType: [Auto, ForceQR, ForceMicroQR] class QREncodeType { - /// The underlying value of this enum member. - String? value; + /// The underlying value of QREncodeType enum. + late final String _value; - QREncodeType._internal(this.value); + QREncodeType._internal(this._value); /// static QREncodeType auto_ = QREncodeType._internal("Auto"); @@ -13,35 +15,33 @@ class QREncodeType { /// static QREncodeType forceMicroQR_ = QREncodeType._internal("ForceMicroQR"); + /// Creates a QREncodeType instance from a JSON representation. QREncodeType.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "ForceQR": - value = data; - break; case "ForceMicroQR": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(QREncodeType data) { - return data.value; - } - + /// Returns a JSON representation of QREncodeType. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of QREncodeType instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of QREncodeType instances. static List listFromJson(List json) { return json.map((value) => QREncodeType.fromJson(value)).toList(); } diff --git a/lib/src/model/qr_error_level.dart b/lib/src/model/qr_error_level.dart index 322bf27..26c45fb 100644 --- a/lib/src/model/qr_error_level.dart +++ b/lib/src/model/qr_error_level.dart @@ -1,8 +1,10 @@ +/// +/// QRErrorLevel: [LevelL, LevelM, LevelQ, LevelH] class QRErrorLevel { - /// The underlying value of this enum member. - String? value; + /// The underlying value of QRErrorLevel enum. + late final String _value; - QRErrorLevel._internal(this.value); + QRErrorLevel._internal(this._value); /// static QRErrorLevel levelL_ = QRErrorLevel._internal("LevelL"); @@ -16,38 +18,34 @@ class QRErrorLevel { /// static QRErrorLevel levelH_ = QRErrorLevel._internal("LevelH"); + /// Creates a QRErrorLevel instance from a JSON representation. QRErrorLevel.fromJson(dynamic data) { switch (data) { case "LevelL": - value = data; - break; case "LevelM": - value = data; - break; case "LevelQ": - value = data; - break; case "LevelH": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(QRErrorLevel data) { - return data.value; - } - + /// Returns a JSON representation of QRErrorLevel. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of QRErrorLevel instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of QRErrorLevel instances. static List listFromJson(List json) { return json.map((value) => QRErrorLevel.fromJson(value)).toList(); } diff --git a/lib/src/model/qr_params.dart b/lib/src/model/qr_params.dart index 3cc2409..47c66d6 100644 --- a/lib/src/model/qr_params.dart +++ b/lib/src/model/qr_params.dart @@ -2,33 +2,33 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// QR parameters. class QrParams { - /* Height/Width ratio of 2D BarCode module. */ + /// Height/Width ratio of 2D BarCode module. double? aspectRatio; -/* DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. */ - @Deprecated( - "This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. ") + /// DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array. Sets the encoding of codetext. String? textEncoding; -/* QR / MicroQR selector mode. Select ForceQR for standard QR symbols, Auto for MicroQR. */ + /// QR / MicroQR selector mode. Select ForceQR for standard QR symbols, Auto for MicroQR. QREncodeType? encodeType; -/* Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details about the used references for encoding the data in the symbol. Current implementation consists all well known charset encodings. */ + /// Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details about the used references for encoding the data in the symbol. Current implementation consists all well known charset encodings. ECIEncodings? eCIEncoding; -/* QR symbology type of BarCode's encoding mode. Default value: QREncodeMode.Auto. */ + /// QR symbology type of BarCode's encoding mode. Default value: QREncodeMode.Auto. QREncodeMode? encodeMode; -/* Level of Reed-Solomon error correction for QR barcode. From low to high: LevelL, LevelM, LevelQ, LevelH. see QRErrorLevel. */ + /// Level of Reed-Solomon error correction for QR barcode. From low to high: LevelL, LevelM, LevelQ, LevelH. see QRErrorLevel. QRErrorLevel? errorLevel; -/* Version of QR Code. From Version1 to Version40 for QR code and from M1 to M4 for MicroQr. Default value is QRVersion.Auto. */ + /// Version of QR Code. From Version1 to Version40 for QR code and from M1 to M4 for MicroQr. Default value is QRVersion.Auto. QRVersion? version; -/* QR structured append parameters. */ + /// QR structured append parameters. StructuredAppend? structuredAppend; + /// Constructor QrParams(); @override @@ -36,6 +36,7 @@ class QrParams { return 'QrParams[aspectRatio=$aspectRatio, textEncoding=$textEncoding, encodeType=$encodeType, eCIEncoding=$eCIEncoding, encodeMode=$encodeMode, errorLevel=$errorLevel, version=$version, structuredAppend=$structuredAppend, ]'; } + /// Creates a QrParams instance from a JSON representation. QrParams.fromJson(Map json) { aspectRatio = json['aspectRatio']?.toDouble(); textEncoding = json['textEncoding']; @@ -47,6 +48,7 @@ class QrParams { structuredAppend = StructuredAppend.fromJson(json['structuredAppend']); } + /// Returns a JSON representation of QrParams. Map toJson() { return { 'AspectRatio': aspectRatio, @@ -60,17 +62,11 @@ class QrParams { }; } + /// Converts a list of JSON objects to a list of QrParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of QrParams instances. static List listFromJson(List json) { return json.map((value) => QrParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = QrParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/qr_version.dart b/lib/src/model/qr_version.dart index 87d53de..7b32aa5 100644 --- a/lib/src/model/qr_version.dart +++ b/lib/src/model/qr_version.dart @@ -1,8 +1,10 @@ +/// +/// QRVersion: [Auto, Version01, Version02, Version03, Version04, Version05, Version06, Version07, Version08, Version09, Version10, Version11, Version12, Version13, Version14, Version15, Version16, Version17, Version18, Version19, Version20, Version21, Version22, Version23, Version24, Version25, Version26, Version27, Version28, Version29, Version30, Version31, Version32, Version33, Version34, Version35, Version36, Version37, Version38, Version39, Version40, VersionM1, VersionM2, VersionM3, VersionM4] class QRVersion { - /// The underlying value of this enum member. - String? value; + /// The underlying value of QRVersion enum. + late final String _value; - QRVersion._internal(this.value); + QRVersion._internal(this._value); /// static QRVersion auto_ = QRVersion._internal("Auto"); @@ -139,161 +141,75 @@ class QRVersion { /// static QRVersion versionM4_ = QRVersion._internal("VersionM4"); + /// Creates a QRVersion instance from a JSON representation. QRVersion.fromJson(dynamic data) { switch (data) { case "Auto": - value = data; - break; case "Version01": - value = data; - break; case "Version02": - value = data; - break; case "Version03": - value = data; - break; case "Version04": - value = data; - break; case "Version05": - value = data; - break; case "Version06": - value = data; - break; case "Version07": - value = data; - break; case "Version08": - value = data; - break; case "Version09": - value = data; - break; case "Version10": - value = data; - break; case "Version11": - value = data; - break; case "Version12": - value = data; - break; case "Version13": - value = data; - break; case "Version14": - value = data; - break; case "Version15": - value = data; - break; case "Version16": - value = data; - break; case "Version17": - value = data; - break; case "Version18": - value = data; - break; case "Version19": - value = data; - break; case "Version20": - value = data; - break; case "Version21": - value = data; - break; case "Version22": - value = data; - break; case "Version23": - value = data; - break; case "Version24": - value = data; - break; case "Version25": - value = data; - break; case "Version26": - value = data; - break; case "Version27": - value = data; - break; case "Version28": - value = data; - break; case "Version29": - value = data; - break; case "Version30": - value = data; - break; case "Version31": - value = data; - break; case "Version32": - value = data; - break; case "Version33": - value = data; - break; case "Version34": - value = data; - break; case "Version35": - value = data; - break; case "Version36": - value = data; - break; case "Version37": - value = data; - break; case "Version38": - value = data; - break; case "Version39": - value = data; - break; case "Version40": - value = data; - break; case "VersionM1": - value = data; - break; case "VersionM2": - value = data; - break; case "VersionM3": - value = data; - break; case "VersionM4": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(QRVersion data) { - return data.value; - } - + /// Returns a JSON representation of QRVersion. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of QRVersion instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of QRVersion instances. static List listFromJson(List json) { return json.map((value) => QRVersion.fromJson(value)).toList(); } diff --git a/lib/src/model/reader_params.dart b/lib/src/model/reader_params.dart index 0a9b4ff..02df34c 100644 --- a/lib/src/model/reader_params.dart +++ b/lib/src/model/reader_params.dart @@ -2,115 +2,117 @@ // ignore_for_file: deprecated_member_use_from_same_package import '../../aspose_barcode_cloud.dart'; +/// Represents BarcodeReader object. class ReaderParams { - /* The type of barcode to read. */ + /// The type of barcode to read. DecodeBarcodeType? type; -/* Multiple barcode types to read. */ + /// Multiple barcode types to read. List? types = []; -/* Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies */ + /// Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies ChecksumValidation? checksumValidation; -/* A flag which force engine to detect codetext encoding for Unicode. */ + /// A flag which force engine to detect codetext encoding for Unicode. bool? detectEncoding; -/* Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality. */ + /// Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality. PresetType? preset; -/* Set X of top left corner of area for recognition. */ + /// Set X of top left corner of area for recognition. int? rectX; -/* Set Y of top left corner of area for recognition. */ + /// Set Y of top left corner of area for recognition. int? rectY; -/* Set Width of area for recognition. */ + /// Set Width of area for recognition. int? rectWidth; -/* Set Height of area for recognition. */ + /// Set Height of area for recognition. int? rectHeight; -/* Value indicating whether FNC symbol strip must be done. */ + /// Value indicating whether FNC symbol strip must be done. bool? stripFNC; -/* Timeout of recognition process in milliseconds. Default value is 15_000 (15 seconds). Maximum value is 30_000 (1/2 minute). In case of a timeout RequestTimeout (408) status will be returned. Try reducing the image size to avoid timeout. */ + /// Timeout of recognition process in milliseconds. Default value is 15_000 (15 seconds). Maximum value is 30_000 (1/2 minute). In case of a timeout RequestTimeout (408) status will be returned. Try reducing the image size to avoid timeout. int? timeout; -/* Window size for median smoothing. Typical values are 3 or 4. Default value is 3. AllowMedianSmoothing must be set. */ + /// Window size for median smoothing. Typical values are 3 or 4. Default value is 3. AllowMedianSmoothing must be set. int? medianSmoothingWindowSize; -/* Allows engine to enable median smoothing as additional scan. Mode helps to recognize noised barcodes. */ + /// Allows engine to enable median smoothing as additional scan. Mode helps to recognize noised barcodes. bool? allowMedianSmoothing; -/* Allows engine to recognize color barcodes on color background as additional scan. Extremely slow mode. */ + /// Allows engine to recognize color barcodes on color background as additional scan. Extremely slow mode. bool? allowComplexBackground; -/* Allows engine for Datamatrix to recognize dashed industrial Datamatrix barcodes. Slow mode which helps only for dashed barcodes which consist from spots. */ + /// Allows engine for Datamatrix to recognize dashed industrial Datamatrix barcodes. Slow mode which helps only for dashed barcodes which consist from spots. bool? allowDatamatrixIndustrialBarcodes; -/* Allows engine to recognize decreased image as additional scan. Size for decreasing is selected by internal engine algorithms. Mode helps to recognize barcodes which are noised and blurred but captured with high resolution. */ + /// Allows engine to recognize decreased image as additional scan. Size for decreasing is selected by internal engine algorithms. Mode helps to recognize barcodes which are noised and blurred but captured with high resolution. bool? allowDecreasedImage; -/* Allows engine to use gap between scans to increase recognition speed. Mode can make recognition problems with low height barcodes. */ + /// Allows engine to use gap between scans to increase recognition speed. Mode can make recognition problems with low height barcodes. bool? allowDetectScanGap; -/* Allows engine to recognize barcodes which has incorrect checksum or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text. */ + /// Allows engine to recognize barcodes which has incorrect checksum or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text. bool? allowIncorrectBarcodes; -/* Allows engine to recognize inverse color image as additional scan. Mode can be used when barcode is white on black background. */ + /// Allows engine to recognize inverse color image as additional scan. Mode can be used when barcode is white on black background. bool? allowInvertImage; -/* Allows engine for Postal barcodes to recognize slightly noised images. Mode helps to recognize slightly damaged Postal barcodes. */ + /// Allows engine for Postal barcodes to recognize slightly noised images. Mode helps to recognize slightly damaged Postal barcodes. bool? allowMicroWhiteSpotsRemoving; -/* Allows engine for 1D barcodes to quickly recognize high quality barcodes which fill almost whole image. Mode helps to quickly recognize generated barcodes from Internet. */ + /// Allows engine for 1D barcodes to quickly recognize high quality barcodes which fill almost whole image. Mode helps to quickly recognize generated barcodes from Internet. bool? allowOneDFastBarcodesDetector; -/* Allows engine for 1D barcodes to recognize barcodes with single wiped/glued bars in pattern. */ + /// Allows engine for 1D barcodes to recognize barcodes with single wiped/glued bars in pattern. bool? allowOneDWipedBarsRestoration; -/* Allows engine for QR/MicroQR to recognize damaged MicroQR barcodes. */ + /// Allows engine for QR/MicroQR to recognize damaged MicroQR barcodes. bool? allowQRMicroQrRestoration; -/* Allows engine to recognize regular image without any restorations as main scan. Mode to recognize image as is. */ + /// Allows engine to recognize regular image without any restorations as main scan. Mode to recognize image as is. bool? allowRegularImage; -/* Allows engine to recognize barcodes with salt and pepper noise type. Mode can remove small noise with white and black dots. */ + /// Allows engine to recognize barcodes with salt and pepper noise type. Mode can remove small noise with white and black dots. bool? allowSaltAndPepperFiltering; -/* Allows engine to recognize image without small white spots as additional scan. Mode helps to recognize noised image as well as median smoothing filtering. */ + /// Allows engine to recognize image without small white spots as additional scan. Mode helps to recognize noised image as well as median smoothing filtering. bool? allowWhiteSpotsRemoving; -/* Allows engine to recognize 1D barcodes with checksum by checking more recognition variants. Default value: False. */ + /// Allows engine to recognize 1D barcodes with checksum by checking more recognition variants. Default value: False. bool? checkMore1DVariants; -/* Allows engine for 1D barcodes to quickly recognize middle slice of an image and return result without using any time-consuming algorithms. Default value: False. */ + /// Allows engine for 1D barcodes to quickly recognize middle slice of an image and return result without using any time-consuming algorithms. Default value: False. bool? fastScanOnly; -/* Allows engine using additional image restorations to recognize corrupted barcodes. At this time, it is used only in MicroPdf417 barcode type. Default value: False. */ + /// Allows engine using additional image restorations to recognize corrupted barcodes. At this time, it is used only in MicroPdf417 barcode type. Default value: False. bool? allowAdditionalRestorations; -/* Sets threshold for detected regions that may contain barcodes. Value 0.7 means that bottom 70% of possible regions are filtered out and not processed further. Region likelihood threshold must be between [0.05, 0.9] Use high values for clear images with few barcodes. Use low values for images with many barcodes or for noisy images. Low value may lead to a bigger recognition time. */ + /// Sets threshold for detected regions that may contain barcodes. Value 0.7 means that bottom 70% of possible regions are filtered out and not processed further. Region likelihood threshold must be between [0.05, 0.9] Use high values for clear images with few barcodes. Use low values for images with many barcodes or for noisy images. Low value may lead to a bigger recognition time. double? regionLikelihoodThresholdPercent; -/* Scan window sizes in pixels. Allowed sizes are 10, 15, 20, 25, 30. Scanning with small window size takes more time and provides more accuracy but may fail in detecting very big barcodes. Combining of several window sizes can improve detection quality. */ + /// Scan window sizes in pixels. Allowed sizes are 10, 15, 20, 25, 30. Scanning with small window size takes more time and provides more accuracy but may fail in detecting very big barcodes. Combining of several window sizes can improve detection quality. List? scanWindowSizes = []; -/* Similarity coefficient depends on how homogeneous barcodes are. Use high value for for clear barcodes. Use low values to detect barcodes that ara partly damaged or not lighten evenly. Similarity coefficient must be between [0.5, 0.9] */ + /// Similarity coefficient depends on how homogeneous barcodes are. Use high value for for clear barcodes. Use low values to detect barcodes that ara partly damaged or not lighten evenly. Similarity coefficient must be between [0.5, 0.9] double? similarity; -/* Allows detector to skip search for diagonal barcodes. Setting it to false will increase detection time but allow to find diagonal barcodes that can be missed otherwise. Enabling of diagonal search leads to a bigger detection time. */ + /// Allows detector to skip search for diagonal barcodes. Setting it to false will increase detection time but allow to find diagonal barcodes that can be missed otherwise. Enabling of diagonal search leads to a bigger detection time. bool? skipDiagonalSearch; -/* Allows engine to recognize tiny barcodes on large images. Ignored if AllowIncorrectBarcodes is set to True. Default value: False. */ + /// Allows engine to recognize tiny barcodes on large images. Ignored if AllowIncorrectBarcodes is set to True. Default value: False. bool? readTinyBarcodes; -/* Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.Other. */ + /// Interpreting Type for the Customer Information of AustralianPost BarCode.Default is CustomerInformationInterpretingType.Other. CustomerInformationInterpretingType? australianPostEncodingTable; -/* The flag which force AustraliaPost decoder to ignore last filling patterns in Customer Information Field during decoding as CTable method. CTable encoding method does not have any gaps in encoding table and sequence \"333\" of filling patterns is decoded as letter \"z\". */ + /// The flag which force AustraliaPost decoder to ignore last filling patterns in Customer Information Field during decoding as CTable method. CTable encoding method does not have any gaps in encoding table and sequence \"333\" of filling patterns is decoded as letter \"z\". bool? ignoreEndingFillingPatternsForCTable; + /// Constructor ReaderParams(); @override @@ -118,6 +120,7 @@ class ReaderParams { return 'ReaderParams[type=$type, types=$types, checksumValidation=$checksumValidation, detectEncoding=$detectEncoding, preset=$preset, rectX=$rectX, rectY=$rectY, rectWidth=$rectWidth, rectHeight=$rectHeight, stripFNC=$stripFNC, timeout=$timeout, medianSmoothingWindowSize=$medianSmoothingWindowSize, allowMedianSmoothing=$allowMedianSmoothing, allowComplexBackground=$allowComplexBackground, allowDatamatrixIndustrialBarcodes=$allowDatamatrixIndustrialBarcodes, allowDecreasedImage=$allowDecreasedImage, allowDetectScanGap=$allowDetectScanGap, allowIncorrectBarcodes=$allowIncorrectBarcodes, allowInvertImage=$allowInvertImage, allowMicroWhiteSpotsRemoving=$allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector=$allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration=$allowOneDWipedBarsRestoration, allowQRMicroQrRestoration=$allowQRMicroQrRestoration, allowRegularImage=$allowRegularImage, allowSaltAndPepperFiltering=$allowSaltAndPepperFiltering, allowWhiteSpotsRemoving=$allowWhiteSpotsRemoving, checkMore1DVariants=$checkMore1DVariants, fastScanOnly=$fastScanOnly, allowAdditionalRestorations=$allowAdditionalRestorations, regionLikelihoodThresholdPercent=$regionLikelihoodThresholdPercent, scanWindowSizes=$scanWindowSizes, similarity=$similarity, skipDiagonalSearch=$skipDiagonalSearch, readTinyBarcodes=$readTinyBarcodes, australianPostEncodingTable=$australianPostEncodingTable, ignoreEndingFillingPatternsForCTable=$ignoreEndingFillingPatternsForCTable, ]'; } + /// Creates a ReaderParams instance from a JSON representation. ReaderParams.fromJson(Map json) { type = DecodeBarcodeType.fromJson(json['type']); types = DecodeBarcodeType.listFromJson(json['types']); @@ -163,6 +166,7 @@ class ReaderParams { json['ignoreEndingFillingPatternsForCTable']; } + /// Returns a JSON representation of ReaderParams. Map toJson() { return { 'Type': type, @@ -205,17 +209,11 @@ class ReaderParams { }; } + /// Converts a list of JSON objects to a list of ReaderParams instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ReaderParams instances. static List listFromJson(List json) { return json.map((value) => ReaderParams.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = ReaderParams.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/region_point.dart b/lib/src/model/region_point.dart index c3d900d..d1fca1b 100644 --- a/lib/src/model/region_point.dart +++ b/lib/src/model/region_point.dart @@ -1,13 +1,15 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Wrapper around Drawing.Point for proper specification. class RegionPoint { - /* X-coordinate */ + /// X-coordinate int? X; -/* Y-coordinate */ + /// Y-coordinate int? Y; + /// Constructor RegionPoint(); @override @@ -15,26 +17,22 @@ class RegionPoint { return 'RegionPoint[X=$X, Y=$Y, ]'; } + /// Creates a RegionPoint instance from a JSON representation. RegionPoint.fromJson(Map json) { X = json['X']; Y = json['Y']; } + /// Returns a JSON representation of RegionPoint. Map toJson() { return {'X': X, 'Y': Y}; } + /// Converts a list of JSON objects to a list of RegionPoint instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of RegionPoint instances. static List listFromJson(List json) { return json.map((value) => RegionPoint.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = RegionPoint.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/result_image_info.dart b/lib/src/model/result_image_info.dart index 0390ae6..ac80208 100644 --- a/lib/src/model/result_image_info.dart +++ b/lib/src/model/result_image_info.dart @@ -1,16 +1,18 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Created image info. class ResultImageInfo { - /* Result file size. */ + /// Result file size. int? fileSize; -/* Result image width. */ + /// Result image width. int? imageWidth; -/* Result image height. */ + /// Result image height. int? imageHeight; + /// Constructor ResultImageInfo(); @override @@ -18,12 +20,14 @@ class ResultImageInfo { return 'ResultImageInfo[fileSize=$fileSize, imageWidth=$imageWidth, imageHeight=$imageHeight, ]'; } + /// Creates a ResultImageInfo instance from a JSON representation. ResultImageInfo.fromJson(Map json) { fileSize = json['fileSize']; imageWidth = json['imageWidth']; imageHeight = json['imageHeight']; } + /// Returns a JSON representation of ResultImageInfo. Map toJson() { return { 'FileSize': fileSize, @@ -32,17 +36,11 @@ class ResultImageInfo { }; } + /// Converts a list of JSON objects to a list of ResultImageInfo instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of ResultImageInfo instances. static List listFromJson(List json) { return json.map((value) => ResultImageInfo.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = ResultImageInfo.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/storage_exist.dart b/lib/src/model/storage_exist.dart index 399ff8e..9315c94 100644 --- a/lib/src/model/storage_exist.dart +++ b/lib/src/model/storage_exist.dart @@ -1,10 +1,12 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// Storage exists class StorageExist { - /* Shows that the storage exists. */ + /// Shows that the storage exists. bool? exists; + /// Constructor StorageExist(); @override @@ -12,25 +14,21 @@ class StorageExist { return 'StorageExist[exists=$exists, ]'; } + /// Creates a StorageExist instance from a JSON representation. StorageExist.fromJson(Map json) { exists = json['exists']; } + /// Returns a JSON representation of StorageExist. Map toJson() { return {'Exists': exists}; } + /// Converts a list of JSON objects to a list of StorageExist instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of StorageExist instances. static List listFromJson(List json) { return json.map((value) => StorageExist.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = StorageExist.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/storage_file.dart b/lib/src/model/storage_file.dart index 00bc435..7361175 100644 --- a/lib/src/model/storage_file.dart +++ b/lib/src/model/storage_file.dart @@ -1,22 +1,24 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// File or folder information class StorageFile { - /* File or folder name. */ + /// File or folder name. String? name; -/* True if it is a folder. */ + /// True if it is a folder. bool? isFolder; -/* File or folder last modified DateTime. */ + /// File or folder last modified DateTime. DateTime? modifiedDate; -/* File or folder size. */ + /// File or folder size. int? size; -/* File or folder path. */ + /// File or folder path. String? path; + /// Constructor StorageFile(); @override @@ -24,6 +26,7 @@ class StorageFile { return 'StorageFile[name=$name, isFolder=$isFolder, modifiedDate=$modifiedDate, size=$size, path=$path, ]'; } + /// Creates a StorageFile instance from a JSON representation. StorageFile.fromJson(Map json) { name = json['name']; isFolder = json['isFolder']; @@ -34,6 +37,7 @@ class StorageFile { path = json['path']; } + /// Returns a JSON representation of StorageFile. Map toJson() { return { 'Name': name, @@ -45,17 +49,11 @@ class StorageFile { }; } + /// Converts a list of JSON objects to a list of StorageFile instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of StorageFile instances. static List listFromJson(List json) { return json.map((value) => StorageFile.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = StorageFile.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/structured_append.dart b/lib/src/model/structured_append.dart index 085a8eb..1f62a5a 100644 --- a/lib/src/model/structured_append.dart +++ b/lib/src/model/structured_append.dart @@ -1,16 +1,18 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +/// QR structured append parameters. class StructuredAppend { - /* The index of the QR structured append mode barcode. Index starts from 0. */ + /// The index of the QR structured append mode barcode. Index starts from 0. int? sequenceIndicator; -/* QR structured append mode barcodes quantity. Max value is 16. */ + /// QR structured append mode barcodes quantity. Max value is 16. int? totalCount; -/* QR structured append mode parity data. */ + /// QR structured append mode parity data. int? parityByte; + /// Constructor StructuredAppend(); @override @@ -18,12 +20,14 @@ class StructuredAppend { return 'StructuredAppend[sequenceIndicator=$sequenceIndicator, totalCount=$totalCount, parityByte=$parityByte, ]'; } + /// Creates a StructuredAppend instance from a JSON representation. StructuredAppend.fromJson(Map json) { sequenceIndicator = json['sequenceIndicator']; totalCount = json['totalCount']; parityByte = json['parityByte']; } + /// Returns a JSON representation of StructuredAppend. Map toJson() { return { 'SequenceIndicator': sequenceIndicator, @@ -32,17 +36,11 @@ class StructuredAppend { }; } + /// Converts a list of JSON objects to a list of StructuredAppend instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of StructuredAppend instances. static List listFromJson(List json) { return json.map((value) => StructuredAppend.fromJson(value)).toList(); } - - static Map mapFromJson( - Map> json) { - final map = {}; - if (json.isNotEmpty) { - json.forEach((String key, Map value) => - map[key] = StructuredAppend.fromJson(value)); - } - return map; - } } diff --git a/lib/src/model/text_alignment.dart b/lib/src/model/text_alignment.dart index aa36f2a..3de95e1 100644 --- a/lib/src/model/text_alignment.dart +++ b/lib/src/model/text_alignment.dart @@ -1,8 +1,10 @@ +/// +/// TextAlignment: [Left, Center, Right] class TextAlignment { - /// The underlying value of this enum member. - String? value; + /// The underlying value of TextAlignment enum. + late final String _value; - TextAlignment._internal(this.value); + TextAlignment._internal(this._value); /// static TextAlignment left_ = TextAlignment._internal("Left"); @@ -13,35 +15,33 @@ class TextAlignment { /// static TextAlignment right_ = TextAlignment._internal("Right"); + /// Creates a TextAlignment instance from a JSON representation. TextAlignment.fromJson(dynamic data) { switch (data) { case "Left": - value = data; - break; case "Center": - value = data; - break; case "Right": - value = data; + _value = data; break; default: throw Exception('Unknown enum value to decode: $data'); } } - static dynamic encode(TextAlignment data) { - return data.value; - } - + /// Returns a JSON representation of TextAlignment. String? toJson() { - return value; + return _value; } @override String toString() { - return value == null ? "null" : value.toString(); + return _value.toString(); } + /// Converts a list of JSON objects to a list of TextAlignment instances. + /// + /// @param json The list of JSON objects to convert. + /// @return A list of TextAlignment instances. static List listFromJson(List json) { return json.map((value) => TextAlignment.fromJson(value)).toList(); } diff --git a/test/put_generate_multiple_get_barcode_recognize_test.dart b/test/put_generate_multiple_get_barcode_recognize_test.dart index f7924b3..89c6e99 100644 --- a/test/put_generate_multiple_get_barcode_recognize_test.dart +++ b/test/put_generate_multiple_get_barcode_recognize_test.dart @@ -29,7 +29,7 @@ void main() { await TestConfig.barcodeApi.getBarcodeRecognize( remoteFileName, folder: TestConfig.folder, - preset: PresetType.highPerformance_.value, + preset: PresetType.highPerformance_.toString(), types: [DecodeBarcodeType.qR_, DecodeBarcodeType.dataMatrix_], );