Created
April 7, 2020 07:18
-
-
Save nuelsoft/8bdfd98302b602b6d7df0544617cd8dc to your computer and use it in GitHub Desktop.
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
final List<Map<String, List<String>>> entries = [ | |
{ | |
"2020-4-15": ["forex", "Movie"] | |
}, | |
{"2020-4-22": []}, | |
{ | |
"2020-5-15": ["forex", "Movie"] | |
}, | |
{ | |
"2020-6-14": ["forex", "forex", "Movie"] | |
}, | |
{ | |
"2020-7-14": ["forex", "forex", "Movie"] | |
}, | |
{ | |
"2020-8-13": ["forex", "forex", "Movie"] | |
}, | |
{ | |
"2020-9-12": ["forex", "Movie", "Forex"] | |
} | |
]; | |
List<String> getEntries(DateTime dt) { | |
String _date = "${dt.year}-${dt.month}-${dt.day}"; | |
print(_date); | |
List<String> entry = []; | |
for (int i = 0; i < entries.length; i++) { | |
if (entries[i][_date] != null) { | |
entry = entries[i][_date]; | |
break; | |
} | |
} | |
return entry; | |
} | |
void main() { | |
print(getEntries(DateTime(2020, 4, 10))); | |
print("\n"); | |
print(getEntries(DateTime(2020, 4, 15))); | |
print("\n"); | |
print(getEntries(DateTime(2020, 9, 12))); | |
print("\n"); | |
print(getEntries(DateTime(2020, 7, 14))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment