Code refactoring

This commit is contained in:
toki 2023-03-09 07:17:25 +09:00
parent f1559c7b07
commit cca078eb43
5 changed files with 15 additions and 8 deletions

View file

@ -63,17 +63,20 @@ class Path {
if (isDir) {
var startDir = Directory(startPath);
var destDir = Directory(destChildPath);
if (!startDir.existsSync())
if (!startDir.existsSync()) {
throw ArgumentError('Start - $startPath is not exist');
}
if (!destDir.existsSync()) destDir.createSync(recursive: true);
var files = startDir.listSync();
for (var file in files) {
if (file is File)
if (file is File) {
await copy(file.path, destDir.path, false,
ignorePattern: ignorePattern, ignoredList: ignoredList);
if (file is Directory)
}
if (file is Directory) {
await copy(file.path, destDir.path, true,
ignorePattern: ignorePattern, ignoredList: ignoredList);
}
}
} else {
var destDir = Directory(destPath);

View file

@ -97,7 +97,9 @@ class SlackAction {
class SlackConfirm {
String? title;
String? text;
// ignore: non_constant_identifier_names
String? ok_text;
// ignore: non_constant_identifier_names
String? dismiss_text;
}
@ -105,6 +107,7 @@ class SlackConfirm {
@JsonSerializable()
class SlackFile {
String? title;
// ignore: non_constant_identifier_names
String? initial_comment;
String? filePath;
String? fileName;

View file

@ -4,6 +4,7 @@ import 'package:color/color.dart';
import 'package:http/http.dart' as http;
import 'slack_data.dart';
import 'package:dart_framework/utils/string_util.dart';
enum SlackBuildType { android, ios, windows, mac, web }
@ -146,6 +147,7 @@ class SlackSender {
? '${buildURL}android.png'
: '${buildURL}appstore.png';
String projectIcon = "$buildURL$appName/icon.png";
// ignore: unused_local_variable
String emoji =
buildType == SlackBuildType.android ? ":android1: " : ":ios0: ";
String osColor = buildType == SlackBuildType.ios ? "#ED145B" : "#81CA3F";
@ -181,8 +183,4 @@ class SlackSender {
var typeStr = type.toString().replaceAll('SlackBuildType.', '');
return toPascal(typeStr);
}
String toPascal(String raw) {
return '${raw[0].toUpperCase()}${raw.substring(1).toLowerCase()}';
}
}

View file

@ -0,0 +1,3 @@
String toPascal(String raw) {
return '${raw[0].toUpperCase()}${raw.substring(1).toLowerCase()}';
}

View file

@ -68,7 +68,7 @@ Map<String, dynamic>? getMapFromYaml(String yamlStr) {
Future<String> getIPAddress(String domain) async {
var c = Completer<String>();
var ipAddress;
late String ipAddress;
var regEx = RegExp(r'(://)([a-zA-Z0-9-.]+)(/|:)');
var match = regEx.firstMatch(domain);
if (match != null && match.groupCount > 2) {