-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: added dateformatter & logger + updated dependencies
- Loading branch information
1 parent
f9e61f4
commit 0716081
Showing
5 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:intl/intl.dart'; | ||
|
||
class DateFormatterUtil { | ||
const DateFormatterUtil._(); | ||
static String formatDate(DateTime date) { | ||
final localDate = date.toLocal(); | ||
final dateFormat = DateFormat('dd/MM/yyyy'); | ||
return dateFormat.format(localDate); | ||
} | ||
|
||
static String formatTime(DateTime date) { | ||
final localDate = date.toLocal(); | ||
final dateFormat = DateFormat('HH:mm'); | ||
return dateFormat.format(localDate); | ||
} | ||
|
||
static String formatDateTime(DateTime date) { | ||
final localDate = date.toLocal(); | ||
final dateFormat = DateFormat('dd/MM/yyyy HH:mm'); | ||
return dateFormat.format(localDate); | ||
} | ||
|
||
static String customFormat(DateTime date, String format) { | ||
final localDate = date.toLocal(); | ||
final dateFormat = DateFormat(format); | ||
return dateFormat.format(localDate); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'package:flutter/foundation.dart'; | ||
|
||
class ImpaktfullLogger { | ||
const ImpaktfullLogger._(); | ||
|
||
static void log(Object message) { | ||
if (kDebugMode) print(message); | ||
} | ||
|
||
static void logError(String message, {Object? error, StackTrace? trace}) { | ||
log(message); | ||
if (error != null) { | ||
log(error); | ||
} | ||
if (trace != null) { | ||
log(trace); | ||
} | ||
} | ||
|
||
static void logFullError( | ||
String message, { | ||
required Object? error, | ||
required StackTrace? trace, | ||
}) => | ||
logError(message, error: error, trace: trace); | ||
|
||
static void verbose(Object message) => log(message); | ||
|
||
static void debug(Object message) => log(message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters