Sonnat Project
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.
 
 

45 lines
1.1 KiB

import 'dart:io';
import 'package:flutter/foundation.dart';
class Utilities {
static String charInjector(
String s,
String char,
int loopIndex, {
bool loop = false,
}) {
var text = s.split('').reversed.join();
if (!loop) {
if (text.length < loopIndex) {
return s;
}
var before = text.substring(0, loopIndex);
var after = text.substring(loopIndex, text.length);
return before + char + after;
} else {
if (loopIndex == 0) {
return s;
}
var a = StringBuffer();
for (var i = 0; i < text.length; i++) {
if (i != 0 && i % loopIndex == 0) {
a.write(char);
}
a.write(String.fromCharCode(text.runes.elementAt(i)));
}
return a.toString().split('').reversed.join();
}
}
static bool get isWeb => kIsWeb;
static bool get isAndroid => Platform.isAndroid;
static bool get isIos => Platform.isIOS;
static bool get isMobile => Platform.isAndroid || Platform.isIOS;
static bool get isDesktop => Platform.isWindows || Platform.isMacOS || Platform.isMacOS;
}