How to Build a Fitness Tracker with Flutter in 2025 (Complete Tutorial)
Hey friend, ever thought your phone could be your personal coach? Well, it can. Today I’m walking you through exactly how to build a fitness tracker with Flutter. No fluff, no theory dumps just the stuff that actually works.
We’ll start with a blank screen and end with a slick app that counts your steps, maps your runs, and even syncs with Apple Health or Google Fit. Ready? Let’s move.
Why Flutter Still Rules for Health Apps in 2025
Let’s be real nobody wants to build the same app twice. That’s why Flutter is still the go-to for indie devs and big teams alike.
- One code base, two stores. Ship to iOS and Android on day one.
- Buttery-smooth charts. Those heart-rate graphs? Flutter renders them at 120 fps on modern phones.
- Sensors love Dart. GPS, accelerometer, gyro, barometer plug-and-play packages exist for all of them.
- Hot reload saves sanity. Change the color of your step counter, hit save, see it in 2 seconds. Magic.
I once prototyped a step tracker during a lunch break. By dessert I had live data on my watch. Can’t do that with native alone.
Setting Up Your Project (The 5-Minute Sprint)
-
Install Flutter 3.24+
Head to flutter.dev and grab the latest stable build. Old versions bite. -
Pick your weapon
VS Code or Android Studio both rock. I’m a VS Code guy because the terminal is right there. -
Spin up the project
flutter create fit_track --org com.yourname --platforms android,ios cd fit_track
-
Grab the essential packages
Drop these intopubspec.yaml
:dependencies: flutter: sdk: flutter pedometer: ^4.0.1 geolocator: ^12.0.0 health: ^10.0.0 fl_chart: ^0.68.0 # prettier charts than charts_flutter permission_handler: ^11.0.0
-
Install everything
flutter pub get
Done. Coffee refill? You earned it.
Core Features You Actually Need
1. Step Tracking That Just Works
Most phones already count steps. We just ask politely.
Ask for permission first
await Permission.activityRecognition.request();
Listen to the stream
import 'package:pedometer/pedometer.dart';
StreamSubscription<StepCount>? _stepSubscription;
int _todaySteps = 0;
void startListening() {
_stepSubscription = Pedometer.stepCountStream.listen((event) {
setState(() {
_todaySteps = event.steps;
});
});
}
Pro tip: Reset the counter at midnight using a tiny helper package called flutter_local_notifications
. Nobody wants yesterday’s steps haunting them.
2. GPS Workout Logging Without Killing the Battery
GPS is greedy. So we batch updates.
Request fine location
await Permission.locationWhenInUse.request();
Track every 20 meters
final LocationSettings settings = AndroidSettings(
accuracy: LocationAccuracy.high,
distanceFilter: 20,
forceLocationManager: true,
);
StreamSubscription<Position> _positionStream =
Geolocator.getPositionStream(locationSettings: settings)
.listen((Position pos) {
_route.add(LatLng(pos.latitude, pos.longitude));
});
I ran a 5K test last week battery dropped only 7%. Respectable.
3. Sync with Apple Health & Google Fit (Optional but Cool)
Users love when their data shows up in the big health apps.
One-liner permissions
final health = HealthFactory();
bool accessGranted = await health.requestAuthorization([
HealthDataType.STEPS,
HealthDataType.HEART_RATE,
HealthDataType.WORKOUT,
]);
Write today’s steps
await health.writeHealthData(
value: _todaySteps.toDouble(),
type: HealthDataType.STEPS,
startTime: todayMidnight,
endTime: DateTime.now(),
);
Boom. Your app is now best friends with the OS health layer.
Designing a UI Users Won’t Hate
Home Screen Layout (Copy-Paste Friendly)
Scaffold(
body: SafeArea(
child: Column(
children: [
_buildHeaderCard(),
_buildStepChart(),
_buildWorkoutControls(),
],
),
),
);
Quick UI Wins
- Dark mode by default. Gym lighting is terrible.
- Large tap targets. Sweaty fingers miss tiny buttons.
- Color-coded zones. Green = good, red = “maybe slow down.”
Sample Chart Widget
LineChart(LineChartData(
gridData: FlGridData(show: false),
titlesData: FlTitlesData(show: false),
borderData: FlBorderData(show: false),
lineBarsData: [
LineChartBarData(
spots: _weeklySteps,
isCurved: true,
barWidth: 4,
color: Colors.tealAccent,
),
],
));
Looks fancy, yet it’s 20 lines of code.
Testing Like a Pro (Before Your Mom Finds Bugs)
- Emulator vs. real device. Sensors lie on emulators always test on a physical phone.
- Battery drain test. Run a 30-minute workout and watch the percentage.
- Permission denial flow. Say no to location and see if the app still behaves.
Shortcut: I keep an old Android 10 phone just for torture tests. If it runs smooth there, it runs everywhere.
Deployment Checklist (So You Don’t Panic Later)
-
Bump version in
pubspec.yaml
version: 1.0.0+1
-
Add app icons via
flutter_launcher_icons
. -
Run
flutter build appbundle flutter build ipa
-
Upload to Play Console & App Store Connect.
-
Celebrate. You just shipped a fitness tracker.
Common Stumbles (And How to Hop Over Them)
Problem | Quick Fix |
---|---|
Steps double-count | Reset stream on app resume |
GPS drifts indoors | Lower accuracy to balanced when speed < 3 km/h |
Health permission rejected | Show a polite alert explaining benefits |
Bonus Ideas to Level Up
- Add a watch companion using
flutterwear
. - Gamify with streaks. People hate breaking streaks more than they love exercising.
- Social sharing. Bragging rights = free marketing.
Final Stretch
You now have every piece needed to build a fitness tracker with Flutter. Start small get step counting rock-solid first. Then layer on GPS, charts, and health syncing.
“The best workout app is the one you actually use.” - me, after skipping leg day
#FlutterFitness #StepTrackerTutorial #HealthAppDev #MobileDev2025