Answers for "File dart get file extension"

0

File dart get file extension

You can use the extension function in the path package to get the extension 
from a file path:

import 'package:path/path.dart' as p;

final path = '/some/path/to/file/file.dart';

final extension = p.extension(path); // '.dart'

If your file has multiple extensions, like file.dart.js, you can specify the
optional level parameter:

final extension = p.extension('file.dart.js', 2); // '.dart.js'
Posted by: Guest on March-03-2022

Code answers related to "Dart"

Browse Popular Code Answers by Language