OpenWeatherByCity class

A widget that displays weather information for a specified city.

This widget provides an easy way to integrate weather data into your application. It displays weather information based on the provided cityName.

To use this widget, you must provide a valid apiKey. You can specify the unit of measurement for the weather data using weatherUnits. The default unit is WeatherUnits.IMPERIAL.

You can also customize the color of the displayed text using color and the language of the weather information using language.

For more information, please refer to the documentation.

Inheritance

Constructors

OpenWeatherByCity({Key? key, required String apiKey, required String cityName, WeatherUnits weatherUnits = WeatherUnits.IMPERIAL, Color color = Colors.black, Languages language = Languages.ENGLISH})
Creates an OpenWeatherByCity widget.
const

Properties

apiKey String
The API key required to fetch weather data.
final
cityName String
The name of the city for which to display weather information.
final
color Color
The color of the displayed text. The default value is Colors.black.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
language Languages
The language of the weather information. The default value is Languages.ENGLISH.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
weatherUnits WeatherUnits
The unit of measurement for the weather data. The default value is WeatherUnits.IMPERIAL.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<OpenWeatherByCity>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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