You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
650 B

class SyntaxService {
static String detectFileType(String fileName) {
final extension = fileName.split('.').last.toLowerCase();
switch (extension) {
case 'dart':
return 'dart';
case 'java':
return 'java';
case 'js':
return 'javascript';
case 'py':
return 'python';
case 'html':
return 'html';
case 'css':
return 'css';
case 'json':
return 'json';
case 'xml':
return 'xml';
case 'md':
return 'markdown';
case 'yaml':
case 'yml':
return 'yaml';
default:
return 'text';
}
}
}