Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 21
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 21
22_23-J 21
Commits
a6a98093
Commit
a6a98093
authored
May 10, 2023
by
Rathnayake K.U.R.S.D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added disease services
parent
74dfb88c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
FrontEnd/lib/services/disease_service.dart
FrontEnd/lib/services/disease_service.dart
+37
-0
No files found.
FrontEnd/lib/services/disease_service.dart
0 → 100644
View file @
a6a98093
import
'package:cloud_firestore/cloud_firestore.dart'
;
import
'../models/error_model.dart'
;
class
DiseaseService
{
static
final
_leafs
=
FirebaseFirestore
.
instance
.
collection
(
'leafs'
);
static
Future
<
QuerySnapshot
<
Map
<
String
,
dynamic
>>?>
getLeafsById
(
int
id
)
async
{
QuerySnapshot
<
Map
<
String
,
dynamic
>>?
documentSnapshot
;
try
{
documentSnapshot
=
await
_leafs
.
where
(
'id'
,
isEqualTo:
id
).
get
();
}
on
FirebaseException
catch
(
e
)
{
ErrorModel
.
errorMessage
=
e
.
message
!;
}
on
Exception
catch
(
e
)
{
ErrorModel
.
errorMessage
=
e
.
toString
();
}
return
documentSnapshot
;
}
static
Future
<
QuerySnapshot
<
Map
<
String
,
dynamic
>>?>
getDiseaseById
(
String
leafRef
,
int
id
)
async
{
QuerySnapshot
<
Map
<
String
,
dynamic
>>?
documentSnapshot
;
try
{
documentSnapshot
=
await
_leafs
.
doc
(
leafRef
)
.
collection
(
"diseases"
)
.
where
(
'id'
,
isEqualTo:
id
)
.
get
();
}
on
FirebaseException
catch
(
e
)
{
ErrorModel
.
errorMessage
=
e
.
message
!;
}
on
Exception
catch
(
e
)
{
ErrorModel
.
errorMessage
=
e
.
toString
();
}
return
documentSnapshot
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment