Want to convert Flutter color to string and back to a color? If you had a dog and an animal class you could use as to specify that your animal is actually a dog (as long as the object is actually a dog).
1 2 3 4 5 6 7 8 9 10 11 | class Animal {} class Dog extends Animal {} Animal animal = new Dog(); Dog bob = animal as Dog; // works, since animal is actually a dog Animal animal2 = new Animal(); // fails, since animal2 is actually an Animal Dog bob2 = animal2 as Dog; |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.