'flutter material icons - the getter 'currency_ruble' isn't defined for the type 'Icons'
The icon set contains the ruble currency, but if i try to add to the project i get error The getter 'currency_ruble' isn't defined for the type 'Icons'
IconButton(icon: Icon(Icons.currency_ruble))
flutter doctor
[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.19042.1348], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.62.3)
[√] Connected device (3 available)
Solution 1:[1]
encountered the same problem with a different icon. You can try either of the following:
Use this regularly updated material io package and see if your ruble currency appears: material_design_icons_flutter package
Solution 2:[2]
Flutter has a cached version of the app on the device . Run
flutter clean
in your app directory.
OR check whether material icon dependency is in pubspec.yaml or not:
flutter:
uses-material-design: true
Solution 3:[3]
There is no icons for "currency_ruble". Currencuy_ruble is not of type IconData. That's why it's showing error. If you want to use custom icon then use that icon by using Image.asset() if currency_ruble is of type image or SvgPicture.asset() if it's of type .svg
IconButton(onPressed: onPressed, icon: Image.asset("<image file name>"))
Solution 4:[4]
I was using 2.8.1 which didn't have latest icons. Once I upgraded the version to 2.10.5 I was able to find the missing icons.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | dstacklurker |
Solution 2 | |
Solution 3 | Lakshydeep Vikram Sah |
Solution 4 | Hariharasubramaniyam |