AngularDart custom SVG mat-icon

Issue

I’m trying to register custom SVG icons to use as Material icons, specifically national flags.

In Angular I would use MatIconRegistry.addSvgIcon(..) in conjunction with DomSanitizer.

In AngularDart I’ve found DomSanitizationService, but so far I’m unable to find the equivalent of MatIconRegistry.

Solution

We use a mix-in if you want to override any material-icons in an angular_component here: https://github.com/dart-lang/angular_components/blob/7f254c89cbbd512cc284a7e9d03bb687f9948bd9/angular_components/lib/material_icon/_mixins.scss#L51

If you are just working with icons separately and it isn’t overriding one that is already included. I suggest just working with the SVG itself outside of material-icon.

Answered By – Ted Sander

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *