Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2900
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sara Savanovic Djordjevic
PROG2900
Merge requests
!2
App2
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
App2
app2
into
main
Overview
0
Commits
18
Pipelines
0
Changes
32
Merged
Sara Savanovic Djordjevic
requested to merge
app2
into
main
1 year ago
Overview
0
Commits
18
Pipelines
0
Changes
32
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
97f6e99a
18 commits,
1 year ago
32 files
+
378
−
223
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
32
Search (e.g. *.vue) (Ctrl+P)
app/lib/pages/marker_handler/get_markers.dart
+
20
−
9
Options
@@ -7,25 +7,36 @@ import 'marker_data.dart';
// fetchMarkerTemplate requests all marker data from the server
Future
<
List
<
Measurement
>>
fetchMarkerData
()
async
{
try
{
// Custom HTTP client
HttpClient
client
=
HttpClient
()
.
.
badCertificateCallback
=
(
X509Certificate
cert
,
String
host
,
int
port
)
=
>
true
;
.
.
badCertificateCallback
=
// NB: temporary disable SSL certificate validation
(
X509Certificate
cert
,
String
host
,
int
port
)
=
>
true
;
// Request markers from API
var
request
=
await
client
.
getUrl
(
Uri
.
parse
(
serverURI
+
mapEndpoint
));
var
response
=
await
request
.
close
();
var
response
=
await
request
.
close
();
// Close response body at end of function
// Parse body to JSON if request is ok
if
(
response
.
statusCode
==
200
)
{
var
responseBody
=
await
response
.
transform
(
utf8
.
decoder
)
.
join
();
List
<
dynamic
>
jsonData
=
json
.
decode
(
responseBody
);
return
jsonData
.
map
((
data
)
=
>
Measurement
.
Measurement
(
data
))
.
toList
();
if
(
responseBody
.
isNotEmpty
)
{
var
jsonData
=
json
.
decode
(
responseBody
);
if
(
jsonData
!=
null
&&
jsonData
is
List
)
{
// Check if jsonData is not null and is a List
return
jsonData
.
map
((
data
)
=
>
Measurement
.
Measurement
(
data
))
.
toList
();
}
else
{
throw
Exception
(
'Failed to parse marker data: Unexpected response format'
);
}
}
else
{
throw
Exception
(
'Failed to parse marker data: Empty response body'
);
}
}
else
{
print
(
'Request failed with status:
${response.statusCode}
'
);
throw
Exception
(
'Failed to parse marker data'
);
throw
Exception
(
'Failed to fetch marker data: Status code
${response.statusCode}
'
);
}
}
catch
(
e
)
{
print
(
'Error:
$e
'
);
throw
Exception
(
'
f
ailed to
connect to the server. Please check your network connection
'
);
print
(
'Error
fetching marker data
:
$e
'
);
throw
Exception
(
'
F
ailed to
fetch marker data:
${e.toString()}
'
);
}
}
Loading