Skip to content

Instantly share code, notes, and snippets.

@umutcoskun
Last active June 21, 2022 15:36
Show Gist options
  • Save umutcoskun/ca7622813901fc4b0b7b355d5a5dee71 to your computer and use it in GitHub Desktop.
Save umutcoskun/ca7622813901fc4b0b7b355d5a5dee71 to your computer and use it in GitHub Desktop.
static void LogPrint(Object object) async {
int defaultPrintLength = 1020;
if (object.toString().length <= defaultPrintLength) {
print(object);
} else {
String log = object.toString();
int start = 0;
int endIndex = defaultPrintLength;
int logLength = log.length;
int tmpLogLength = log.length;
while (endIndex < logLength) {
print(log.substring(start, endIndex));
endIndex += defaultPrintLength;
start += defaultPrintLength;
tmpLogLength -= defaultPrintLength;
}
if (tmpLogLength > 0) {
print(log.substring(start, logLength));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment