IsoObject extension type

Extension type for handling ISO codes from any object.

This extension type wraps any Object to provide specialized ISO code functionality without affecting the global Object scope.

Example usage:

import 'package:sealed_languages/sealed_languages.dart';

enum Colors { red, green, blue }

void main() {
  const color = Colors.green;
  assert(IsoObject(color).toUpperCaseCode() == 'GREEN');

  const text = ' Hello, World! ';
  assert(IsoObject(text).toUpperCaseCode() == 'HELLO, WORLD!');

  final buffer = StringBuffer(' eng ');
  assert(IsoObject(buffer.toString()).toUpperCaseCode() == 'ENG');
}
on
Implemented types

Constructors

IsoObject(Object value)
Creates an ISO code wrapper for any Object value.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
isIsoAlphaRegularCode → bool
Checks if the object's string representation is a valid ISO code.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

maybeMapIsoCode<T extends Object?>({required T orElse(String input), int maxLength = IsoStandardized.codeLength, int minLength = IsoStandardized.codeShortLength, T numeric(String code)?, T regular(String code)?, T short(String code)?}) → T
Maps the ISO code of the object's string representation to a value based on the code's length and type.
maybeToValidIsoCode({int? exactLength, int maxLength = IsoStandardized.codeLength, int minLength = IsoStandardized.codeShortLength}) → String?
Trims the object's string representation to an ISO code if its length is within the valid ISO codes range. If the string is not a valid regular ISO code, it returns null. The maxLength and minLength parameters control the maximum and minimum length of the trimmed string. The optional exactLength parameter specifies the exact length of the trimmed string.
maybeToValidIsoUpperCaseCode({int? exactLength, int maxLength = IsoStandardized.codeLength, int minLength = IsoStandardized.codeShortLength}) → String?
Trims and converts the object's string representation to an ISO code to uppercase if its length is within the valid ISO codes range. If the string is not a valid regular ISO code, it returns null. The maxLength and minLength parameters control the maximum and minimum length of the trimmed string. The optional exactLength parameter specifies the exact length of the trimmed string.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toCode() → String
Converts the object to a trimmed, String representation.
toString() → String
A string representation of this object.
inherited
toUpperCaseCode() → String
Converts the object to a trimmed, uppercase String representation.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

maybe(Object? value) → IsoObject?
Creates an ISO code wrapper for any Object? value.