The Flutter-based app for the DOLFIN Project.
Babies who are born very early, or who suffer poor blood supply or lack of oxygen to the brain before or around birth, are more likely to have problems with their brain development and child neurological development. This may affect how children think and learn, communicate, play, and interact with the world around them.
DOLFIN aims to answer the research question:
In babies who are born very early or who suffer poor blood supply or lack of oxygen to the brain before or around birth, does giving a nutritional supplement daily for a year improve long-term cognitive development?
The NPEU team have access to the Firebase database using a service account with a private key. This expires around the beginning of June annually. NPEU will give us a new public key and we upload this to the service account through the Google console.
PI: Jeremy Parr
RSEs:
- Imre Draskovits (@notimre)
- Mike Simpson (@mdsimpson42)
- Kate Court (@KateCourt)
- Mark Turner (@markdturner)
- doflin-flutter: Production repository (left side of the diagram)
- dolfin-development: This repository. DOLFIN Admin app 'dev' branch, created for NPEU team (right side of the diagram)
- dolfin-firebase: Includes Firebase Cloud Funcitons, Push Notifications and Database (top left of the diagram)
- dolfin-firebase: Development Firebase Cloud Funcitons, Push Notifications and Database (top right of the diagram)
This repository contains both 'DOLFIN App' & 'DOLFIN App Admin'.
The apps are identical with a key exception: Admin app is built with the .env
file pointing to the test API, while the DOLFIN App is the production ready version.
The production ready version is not accessible to anyone besides the trial participants. This also excludes both DOLFIN and RSE teams.
The application uses Flutter, which is written in Dart; both developed and maintained by Google.
-
Install the following to get started on the project:
- Flutter Framework (this also installs Dart for you, no need to do it explicitly): Flutter MacOS
- IMPORTANT NOTES POST INSTALL:
- Must be downgraded to: Flutter version 3.16.9 channel stable
- Do NOT run
$ dart fix
- Do NOT adjust
pubspec.yaml
file! Unless you are keen on predicate logic
- Xcode available on the Mac App Store
- Android Studio available from the Jetbrains Toolbox App
If you have an instalation of Flutter already, and installed this using homebrew, you may not be able to downgrade Flutter. If this is the case, remove your Flutter installation and install only the required version using these instructions for installation and selecting the correct installation from here.
- Flutter Framework (this also installs Dart for you, no need to do it explicitly): Flutter MacOS
-
Determine whether you need Ruby (version manager) on a Mac
Developing on Mac requires you to install additional Ruby versions, which is not interfering with the system built-in one.
Recommended to check out rbenv. A Ruby version manager.chruby
is also a good alternative.To determine if you need to install a Ruby Version manager, run:
$ which ruby
If it returns
$ /usr/bin/ruby
You need to install a ruby version manager for MacOS to develop iOS apps.
-
Refer to rbenv repo regarding installation.
-
Install Android Emulator
You want to set up an Android emulator with API 34 or above running Android 14 or above. Do this within Android Studio (Step 1)
The project is 80:20 split focused in favour of Android, recommended to use Android Studio throughout the development in general. -
Install iOS Simulators
XCode 15 (or newer) will come pre-installed with the relevant up-to-date iOS simulators. No need to do anything else.
Run the following command to confirm you installed everything above correctly:
$ flutter doctor
If you see the following output, you are good to go:
- Find the
.env
file on RSE Team OneDrive. - Clone the repository and place the
.env
file at root level ofdolfin-flutter/
directory
You need to configure the application on Android as well as on iOS with Firebase.
If you skip this step, you will have a hard time debugging what is going on with no errors showing.
- Download the relevant
google-services.json
file from Firebase.
To confirm you have the correct file, you will seeuk.ac.ncl.rse.dolfin.admin
underpackage-name
. - Copy the file to
dolfin-flutter/android/app/
directory
Run the Android App for the first time
- Open the Android Simulator manually (as flutter can't do it for you)
- Install the flutter packages
$ flutter pub get
- Run the project
$ flutter run
- Manually select the Android Simulator
- Wait until it builds
- Download the relevant
GoogleService-Info.plist
file from Firebase - Copy the file to
dolfin-flutter/ios/
directory - Open XCode at
dolfin-flutter/ios/Runner.xcodeproj
- Right-click 'Runner'
- Add Files to "Runner"
- Select
GoogleService-Info.plist
- To confirm XCode recognises your file, you need to see it in the XCode file directory
If it doesn't work, follow these steps.
Run the iOS App for the first time
- Open the iOS Simulator manually (as flutter can't do it for you)
- Install the flutter packages
$ flutter pub get
- Install
Pods
$ cd ios
$ pod install
- Run the project
$ flutter run
- Manually select the iOS Simulator
- Wait until it builds
How to build and publish the DOLFIN Admin App:
Prerequisites (each time these have to pre-exist)
- In pubspec.yaml increment version: 0.2.7+207 (E.g. to version: 0.2.8+208)
- Run flutter run and compile it first to an Android emulator
- Put the private_key.pepk and upload-keystore.jks (available from RSE team Onedrive) files under dolfin-flutter-development/android/app/
Building the app
- Open Android Studio at dolfin-flutter-development/android/
- Mac Menu Bar: Build > Generate Signed App Bundle / APK
- Select “Android App Bundle”
- Module: android.app Key store path: <your/path>/dolfin-flutter-development/android/app/upload-keystore.jks Key store password: password Key alias: key Key password: password Select “Remember passwords”
- Build variants: release
- Click “Create”
Publishing the app
-
Open Google Play Console
-
“Create new release”
-
Upload the app-release.aab file
-
Publish from the Publishing Overview
Prerequisites (each time these have to pre-exist)
-
In Info.plist increment
<key>CFBundleShortVersionString</key> <string>2.0.7</string> and <key>CFBundleVersion</key> <string>207</string>
-
Your Apple ID should be part of the Newcastle University Organisation (Team ID: J3676MPZ85)
Building the App
- Open dolfin-flutter-development/
- Run flutter build ipa
Publishing the app
- Locate the .ipa file under /dolfin-flutter-development/build/ios/ipa
- Open Transporter app (https://apps.apple.com/gb/app/transporter/id1450874784?mt=12)
- Upload the uk.ac.ncl.rse.dolfin.admin.ipa file
- Release it on Testflight
The base icon image is specified in pubspec.yaml
and the relevant dependencies should be installed automatically.
To regenerate the icons (for Android and iOS), edit the master image file and then use the following commands:
flutter pub get
flutter pub run flutter_launcher_icons:main
- Initial Development
- Minimum viable product
- Feature-Complete
- Late 2023 Update by Imre
- Early 2024 Update by Imre
This work was funded by a grant from the UK Research Councils, EPSRC grant ref. EP/L012345/1, “Example project title, please update”.