Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mobile Computing Group 5
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Hannes Raschke
Mobile Computing Group 5
Commits
97e6d5aa
Commit
97e6d5aa
authored
1 year ago
by
Florian
Browse files
Options
Downloads
Patches
Plain Diff
sample data only loaded, when opening first time
parent
760c8576
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
trackeroo/lib/logic/services/locator.dart
+8
-7
8 additions, 7 deletions
trackeroo/lib/logic/services/locator.dart
with
8 additions
and
7 deletions
trackeroo/lib/logic/services/locator.dart
+
8
−
7
View file @
97e6d5aa
...
...
@@ -55,14 +55,15 @@ Future<void> setupLocatorService() async {
Box
<
Transaction
>
transactionsBox
=
await
Hive
.
openBox
<
Transaction
>(
'transactions_box'
);
// TODO: remove for prod, only here for dev/test purposes
await
transactionsBox
.
clear
();
List
<
Transaction
>
transactionsFromJson
=
[];
final
String
response
=
await
rootBundle
.
loadString
(
'assets/data/transaction_data.json'
);
final
jsonList
=
await
json
.
decode
(
response
);
for
(
var
json
in
jsonList
)
{
transactionsFromJson
.
add
(
Transaction
.
fromJson
(
json
));
if
(
appState
.
isFirstOpening
)
{
List
<
Transaction
>
transactionsFromJson
=
[];
final
String
response
=
await
rootBundle
.
loadString
(
'assets/data/transaction_data.json'
);
final
jsonList
=
await
json
.
decode
(
response
);
for
(
var
json
in
jsonList
)
{
transactionsFromJson
.
add
(
Transaction
.
fromJson
(
json
));
}
transactionsBox
.
addAll
(
transactionsFromJson
);
}
transactionsBox
.
addAll
(
transactionsFromJson
);
double
balance
=
0
;
double
income
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment