CountryName class final
A class that represents the name of a country in a particular language.
The main difference to the super TranslatedName class is that the
The official (fullName) must be provided and cannot be empty.
The CountryName class is a simple value object that represents the name of
a country in a particular language. It consists of a NaturalLanguage
object that represents the language, and two String values that represent
the official and common names of the country. The official and common
fields must not be empty.
Example usage:
import 'package:sealed_countries/sealed_countries.dart';
void main() {
const countryName = CountryName(
language: LangSlk(),
official: 'Slovenská republika',
common: 'Slovensko',
);
assert(countryName.official == 'Slovenská republika');
assert(countryName.common == 'Slovensko');
}
- Inheritance
-
- Object
- BasicLocale
- TranslatedName
- CountryName
- Available extensions
Constructors
- CountryName({required NaturalLanguage language, required String official, required String common})
-
Creates a new
CountryNameobject with the given language and name values.const
Properties
- asBasicLocale → BasicLocale
-
Available on TranslatedName, provided by the TranslatedNameExtension extension
Returns a BasicLocale object from this TranslatedName that represent locale of translation.no setter - common → String
-
Available on CountryName, provided by the CountryNameExtension extension
Non-nullable alias for a name. The common name of the country.no setter - common → String
-
Available on TranslatedName, provided by the TranslatedNameExtension extension
Just an alias for the name property.no setter - countryCode → String?
-
The region subtag for the locale.
no setterinherited
- fullName → String?
-
Represents the full/official translation.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasNoCountry → bool
-
Available on BasicLocale, provided by the BasicLocaleExtension extension
Returnstrueif the locale has no country code specified.no setter - hasNoScript → bool
-
Available on BasicLocale, provided by the BasicLocaleExtension extension
Returnstrueif the locale has no script specified.no setter - hasOnlyLanguage → bool
-
Available on BasicLocale, provided by the BasicLocaleExtension extension
Returnstrueif the locale has only language specified.no setter - language → NaturalLanguage
-
The NaturalLanguage representing the language of the locale.
finalinherited
- name → String
-
Represents the short/common translation.
finalinherited
- official → String
-
Available on CountryName, provided by the CountryNameExtension extension
Non-nullable alias for a fullName. The official name of the country.no setter - regionalCode → String?
-
Available on BasicLocale, provided by the BasicLocaleExtension extension
An alias for the countryCode. Returns regional/country code of the locale.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- script → Script?
-
The optional script information of type Script.
finalinherited
Methods
-
copyWith(
{String? countryCode, NaturalLanguage? language, Script? script}) → BasicLocale -
Available on BasicLocale, provided by the BasicLocaleExtension extension
Creates a copy of this object with the given fields replaced with the new values. -
copyWith(
{NaturalLanguage? language, String? official, String? common}) → CountryName -
Available on CountryName, provided by the CountryNameExtension extension
Creates a copy of this object with the given fields replaced with the new values. -
copyWith(
{String? countryCode, String? fullName, NaturalLanguage? language, String? name, Script? script}) → TranslatedName -
Available on TranslatedName, provided by the TranslatedNameExtension extension
Creates a copy of this object with the given fields replaced with the new values. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
{JsonCodec codec = const JsonCodec()}) → String -
Returns a JSON-encoded string representation of the object.
override
-
toMap(
) → Map< String, String> -
Available on BasicLocale, provided by the BasicLocaleExtension extension
Converts this object object to a JSON like map. -
toMap(
) → Map< String, String?> -
Available on CountryName, provided by the CountryNameExtension extension
Converts this object object to a JSON like map. -
toMap(
) → Map< String, String> -
Available on TranslatedName, provided by the TranslatedNameExtension extension
Converts this object object to a JSON like map. -
toString(
{bool short = true}) → String -
A string representation of this object.
override
-
toTranslatedName(
String name, {String? fullName}) → TranslatedName -
Available on BasicLocale, provided by the BasicLocaleExtension extension
Creates a TranslatedName instance from this locale with the provided name. -
toUnicodeLocaleId(
{String separator = "_"}) → String -
Available on BasicLocale, provided by the BasicLocaleExtension extension
Returns a string representing the locale.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited