Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove dot(.) on String in Flutter?

Tags:

flutter

dart

assets/images/Defect/icon-5.svg

I need to get svg on above String

example:

print(path);

output only svg


1 Answers

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

like image 64
danypata Avatar answered Oct 27 '25 03:10

danypata



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!