Reputation:
assets/images/Defect/icon-5.svg
I need to get svg on above String
example:
print(path);
output only svg
Upvotes: 4
Views: 6209
Reputation: 10175
There is a function called extension
in package:path/path.dart
that will give you the extension of a file. If you want to remove the .
from that extension you just need to replace it with an empty space, something like:
import 'package:path/path.dart';
String svg = extension("assets/images/Defect/icon-5.svg");
svg = svg.replaceAll(".", "");
print(svg);
Reference here
Upvotes: 6