Skip to content

Glossary: Flutter

as (cast)

Also written: cast, type cast, as String

A cast tells Dart to treat a value as a certain type, such as `json['name'] as String`, and checks at run time that it really is that type. It fails with an error if the key is missing or the type is wrong.

Where the book teaches it

Related terms

factory constructorJSON