SlideShare a Scribd company logo
1 of 63
FROM 10 YEARS NATIVE TO
The story of SNCF Connect with Flutter
1
24/02/2023 #FlutterHeroes23
THE BIGGEST FLUTTER APP IN EUROPE
US (INCL. SPECIAL POWERS ;)
2
Adrien BODY
👨💼 Staff Engineer
🦸 A11Y Hero
Valentin MICHALAK
👨💼 Software Engineer
🦸 E-sport Hero
François NOLLEN
👨💼 Staff Engineer
🦸 Tech Ambassador
OUR JOURNEY WITH FLUTTER
3
• The Project
• Why Flutter ?
• From native to Flutter
• BFF
• Core
• Testing
• Design & Accessibility
• Routing & Monitoring
• Performance
• Conclusion
SNCF CONNECT
« Sustainable mobility accessible for all »
4
OUR APPS BEFORE SNCF CONNECT
5
A NEW DIGITAL SERVICE FOR TRAVEL AND MOBILITY
6
tickets sold in 2022
48 B
kms traveled by
customers in one
year: that’s 3 millions
tons of CO2 saved
1 B
visits in 2022:
that’s 3 millions a day
>190 M
SIMPLER MORE ACCESSIBLE GREENER CUSTOMIZABLE
FROM ZERO TO HERO IN 18 MONTHS
7
Flutter
React + SSR
Kotlin/JVM
100% Cloud-native
Infra-as-Code
State of the Art
Mobile Apps
(150 screens)
Web App
Back-For-Front
Infra
From scratch
Iterate faster
Quality
Continuous Delivery
Monorepo
One codebase
One CI/CD pipeline
Innersource
One team
From 10 to 200
developers*
…in 18 months
(*40 dedicated to Flutter)
18 months
WHY FLUTTER
8
MODERN DECLARATIVE UI CANDIDATES IN 2020
9
Kotlin Multi Platform?
Share business code with server (in Kotlin)
Swift UI (version 1)
Android Jetpack Compose (alpha)
React Native?
Share codebase between App & Web
Performance and boot time issues (in 2020)
Not convinced by tooling (more industrialization, better developer experience?)
“Flutter is an open source
framework by Google for
building beautiful, natively
compiled, multi-platform
applications from a single
codebase. “
« IT’S ALL ABOUT SUSTENTATION »
11
Platforms ( , …)
Your App
(Alexandre, Entreprise Architect)
FLUTTER MET OUR CRITERIA
● Very Good Performances
● Multi-platform
● Binary Size: OK
● Trusted Partners
● Google Contacts
● Early adopters
(Google Pay, Ad Mob, Ali Express, EBay…)
● Mature
● Single Codebase
● Tooling, Developer Experience
Our criteria
(in real life)…
TLDR;)
(simpler version)
LEVERAGING FLUTTER WEB TOO? (IN 2020)
13
PWA build
46.3 Mo
Deferred loading
No pure
HTML
(a11y?)
'pollute’
codebase
Not stable
Stable now
Chart
different between
platforms
CMS content
injection
SEO…
complicated
• Not suitable for our use case
(e-commerce Website for millions of people)
• Yet, a very promising technology!
?
Condi2onal Imports
FROM NATIVE TO FLUTTER
14
MAIN BENEFITS FROM NATIVE
15
üHot Reload
üIndependant
from OS versions
MINDSET CHANGED FROM NATIVE
16
• New paradigm ⚠
• UI-specific iOS / Android
• Open Source 🎉
BRIDGING TO NATIVE
17
• Bridges with Pigeon
• Homemade bridges: Wallet IOS, Google Wallet
• 3rd-party libs: Google Ads
• Method Channel, FFI, …
• 3rd-party Flutter SDKs provided by partners (Datadome, Batch, Instana, Didomi)
BACKEND FOR FRONTEND
18
ARCHITECTURE
BACK-FOR-FRONT APPLICATION SERVER
• BFF = Backend For Frontend
• Presentation logic moved serverside:
• Presentation model / mapping
• Formatting, Localization
• Etc.
ü Mobile/Web consistency 🔐
ü Better TTM 🚀
ü Smaller frontend apps 🌱
19
BFF server
(Back-For-Front)
Other channels
(eg. chatbots)
Mobile
(iOS, Android)
Web
BFF à OPEN API à PROJECT SDK
• Business models generated with Open API
• Dart SDK (for Flutter/Mobile)
• Typescript SDK (for React/Web)
• Classes generated with built_value
(generated immutable serialization/deserialization)
• HTTP clients generated with Dio
• Moustache templates
• Models used for tests with fixtures
20
CORE LIBS
21
THREADS
STATE MANAGEMENT
23
Provider
riverpod
mobX
binder
Fish Redux
flu#er_command
solidart
THREADS IN FLUTTER
24
• Flutter is mono-threaded
• MicroTask Queue, Event Queue
• Futures
• scheduleMicrotask
• Isolates and Computes helper
• Background tasks
HOW WE USE THREADS
25
• Main thread for simple UI and logic
• Isolates/Computes for complexe tasks
• Eg. deserializing with compute dio_flu'er_transformer
• Eg. multiple requests in // with isolate
• scheduleMicrotask
• Eg. network call needed for screen, prior to any other async Future
• workmanager for background native tasks
• Eg. background proactive exchange, based on geolocation
(⚠ Remember that Compute has a little boot overhead time)
TESTING THE APP(S)
26
OUR « TEST PYRAMID »
golden_toolkit
Golden
Basic Widgets Tests
UT over BLoC
Automated E2E
Widget Tests
UI Tests
Integration Tests
Unit Tests
GOLDEN TESTS
31
BDD WITH CUCUMBER & GHERKIN
32
GHERKIN FEATURES
33
Behaviour
(shared with business teams)
Tests Cases
(exhaustive!)
commercial_cards.feature
END-TO-END TESTS WITH GHERKIN
34
E2E TESTS
35
AN IN-HOUSE WRAPPER OVER APPIUM
• Gherkin makes tests reusable between Mobile & Web (differents Glues)…
• In addition, our wrapper over Appium improves:
• Test reusability between Android & iOS (eg. generic types for widgets)
• Shared logic about how we navigate, scroll, etc. during tests
• Accessibility tests & guidelines easier to implement
WIDGET TESTS WITH GHERKIN
36
• Flutter Gherkin
• Widget Object Pattern inspired by E2E Tests and Page Object
• Test your widgets with complex and exhaustive business cases
• Quick to execute
• Glues
• Open source contribution:
👉 https://github.com/sncf-connect-tech/gherkin_widget_extension
https://www.youtube.com/watch?v=QJHdwp0-zN0&t=716s
(meetup Flutter Paris 17/01/2023)
TESTING DEEPLINKS?
37
OUR TEST STRATEGY, RELOADED
38
https://medium.com/@a.poichet/flutter-and-
the-practical-test-pyramid-with-the-bloc-
pattern-6e6bf10dda9d
https://medium.com/@maxime.pontoire/
automated-tests-of-a-flutter-application
-3d878e9d8a61
• Golden
• End 2 End
• Widget Tests
● ⚠ Take time to run + heavy for your Git repo
● ⚠ Not idempotent (OS/architecture) è Docker
● 💚 Still very usefull in MR reviews
● 💚 Reused for Mobile and Web
● ⚠ integration_test limits (Webviews/native modals/perms)
💚 But Appium stable and working well!
● ⚠ But long to execute (cannot test all cases)
● 💚 Great to document code with use cases
● 💚 Fast, help us test all business use cases
DESIGN & ACCESSIBILITY
39
DESIGN SYSTEM
• Figma
• Generated code
• Storybook
(2023: Widgetbook?)
• Flutter Web
40
ACCESSIBILITY MATTERS
41
« The power of the Web
is in its universality.
Access by everyone
regardless of disability
is an essential aspect. »
Tim Berners-Lee, W3C Director
and inventor of the World Wide Web
ACCESSIBILITY MATTERS
42
« The power of the Web
is in its universality.
Access by everyone
regardless of disability
is an essential aspect. »
Tim Berners-Lee, W3C Director
and inventor of the World Wide Web
ACCESSIBILITY WITH FLUTTER
• Very good and customizable 👍
• Dedicated widgets : Semantics, ExcludeSemantics
• Semantic Service
Still a few bugs opened on Flutter repo:
• Focus Bugs
• Read order bugs
• Scroll shadows malfunctions: cacheExtent
• Bridges bugs on some OS with keyboard for example
43
https://abody.medium.com/accessibility-in-
flutter-tips-for-a-more-inclusive-app-
3e8406e9356d
ACCESSIBILITY GOLDENS
44
Golden tests, accessibility-style:
ACCESSIBILITY GOLDENS
45
45
Golden & manual tests in accessibility mode
(enableSemanticDebugger)
find.widgetWithSemanticLabel (custom method)
find.bySemanticsLabel
semanticMatcher
WIDGET TESTS
46
Methods used in testWidget:
meetsGuideline(textContrastGuideline)
meetsGuideline(androidTapTargetGuideline)
meetsGuideline(iOSTapTargetGuideline)
meetsGuideline(labeledTapTargetGuideline)
MEETSGUIDELINE
47
Unit Tests on contrast, tap size and label of a widget:
ROUTING
48
MONITORING
TRACKING
ROUTING & DEEPLINKS
49
go_router
routemaster shelf_router yeet
● We first chose autoroute because it seemed mature
● Watching the go_router roadmap closely ;)
MONITORING
50
Covering both
frontend and
backend
Crash details
and stacktraces
⚠ Obfuscation issue
TRACKING & CONSENTS
• Server-to-server tracking
& consents management (GDPR)
• Frontend instrumentation
(route observer, CMP SDK,
delegating to the BFF)
ü Mobile/Web consistency 🔐
ü Better TTM 🚀
ü Less frontend 3rd-party SDKs 🛡
ü Reduced footprint 🌱
51
S2S
tracking
vendors
BFF server
(Back-For-Front)
Other channels
(eg. chatbots)
Mobile
(iOS, Android)
Web
PERFORMANCE
52
HOW DOES IT GROW? (DEV XP & CI/CD)
53
✅ Acceptable compilation time
No need to modularize (too much)
✅ IDE always reactive
⚠ Test duration
From 1 to 24 seconds per golden test on CI/CD !
2700 tests Flutter
● Cut out in 10 jobs
● ~30m by job
● less than 10m local
Build 32 minutes
Build 22 minutes
Careful when conflicts/rebase
- Generated code
- Goldens
OPTIMIZED BUNDLES
• Android App Bundles
• Optimized bundles
for different devices
• In our case (average):
📉 -48% weight
54
FOOTPRINT
55
85
Running times:
117.5 s
Mobile data:
1.1 Mo
90
Energy:
112.8 mAh
50
• Many ways to contribute to a lower
impact on clients and devices, eg.
• Optimizing bundles
• Server calls and payloads
• Images / font-icons
• Serverside logic
• Limiting SDKs
• …
• Greenspector level Silver (July 2022) 🌱
FRAMERATES
Flutter performance IS impressive
but still…
framerate issues remain with
56
SHADER COMPILATION
⏳
IMPELLER (PREVIEW)
Before (Skia only)
57
After (Impeller)
IMPELLER (PREVIEW)
Very promising. Ready for production?
Pros:
- Very good results on our tests
- Significant performance improvement (less / no more frame issue)
Cons:
- Not yet stable on Android (stable on iOS)
- Issues with some dependencies (eg. Google Ads)
58
FUTURE LOADING…
CONCLUSION
59
SUCCESSFUL PROJECT & PRODUCT
● Biggest Flutter app in Europe (so far!)
● Built/Delivered in 18 months
● Used by millions of people
● Weekly releases
60
WE ❤ FLUTTER FOR…
● 🧑🤝🧑 Consensus among devs (native, backend…)
● 📚 Ultra-rich component library
● 🦺 App resilience
● 🔍 Very good documentation
● 🫶 Great and active community (Flutter Heroes! 👋🦸)
Also :
Declarative UI, Hot reload ⚡, Frequent Updates, Modern language and tools,
Open Source, Performances, Simple Communication with Native…
61
FLUTTER EVEN BETTER WHEN…
🧭 Stable navigation / routing (v1 imperative, v2 declarative, go_router?)
⚡ Remaining perf issues (Google Ads, frame jank à Impeller)
🕵 Code obfuscation // stacktrace (Firebase Crashlytics)
And also :
Dartlang, Flutter OS sensitive, remaining Accessibility issues…
62
63
HAPPILY STICKING WITH FLUTTER FOR WHAT’S NEXT!
RESOURCES WE’VE SHARED (🇫🇷 / 🇬🇧)
64
Flutter @ Devoxx France
E2E Testing with Flutter
Widget Testing with Flutter
Accessibility Testing with Flutter
Flutter Impeller
(☝ resources + jobs + contacts )
Questions
Contact us
Thank you!

More Related Content

Similar to The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)

Docker in Production: How RightScale Delivers Cloud Applications
Docker in Production: How RightScale Delivers Cloud ApplicationsDocker in Production: How RightScale Delivers Cloud Applications
Docker in Production: How RightScale Delivers Cloud ApplicationsRightScale
 
Good bye Massive View Controller!
Good bye Massive View Controller!Good bye Massive View Controller!
Good bye Massive View Controller!Supercharge
 
Keynote Client Connectivity And The Cloud
Keynote Client Connectivity And The CloudKeynote Client Connectivity And The Cloud
Keynote Client Connectivity And The CloudGoogleTecTalks
 
Cloud Native Application Integration With APIs
Cloud Native Application Integration With APIsCloud Native Application Integration With APIs
Cloud Native Application Integration With APIsNirmal Fernando
 
Embarcadero's Connected Development
Embarcadero's Connected DevelopmentEmbarcadero's Connected Development
Embarcadero's Connected DevelopmentJim McKeeth
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015WaveMaker, Inc.
 
Google Cloud - Scale With A Smile (Dec 2014)
Google Cloud - Scale With A Smile (Dec 2014)Google Cloud - Scale With A Smile (Dec 2014)
Google Cloud - Scale With A Smile (Dec 2014)Ido Green
 
What's new in App Engine and intro to App Engine for Business
What's new in App Engine and intro to App Engine for BusinessWhat's new in App Engine and intro to App Engine for Business
What's new in App Engine and intro to App Engine for BusinessChris Schalk
 
1 - Welcome OPEN19 & Partners line-up
1 - Welcome OPEN19 & Partners line-up1 - Welcome OPEN19 & Partners line-up
1 - Welcome OPEN19 & Partners line-upKangaroot
 
Flutter talkshow
Flutter talkshowFlutter talkshow
Flutter talkshowNhan Cao
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...Heiko Voigt
 
Optimize your CI/CD with GitLab and AWS
Optimize your CI/CD with GitLab and AWSOptimize your CI/CD with GitLab and AWS
Optimize your CI/CD with GitLab and AWSDevOps.com
 
Bahrain ch9 introduction to docker 5th birthday
Bahrain ch9 introduction to docker 5th birthday Bahrain ch9 introduction to docker 5th birthday
Bahrain ch9 introduction to docker 5th birthday Walid Shaari
 
Tampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday DockerTampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday DockerSakari Hoisko
 
Velocity NY 2018 "The Cloud Native Developer Workflow"
Velocity NY 2018 "The Cloud Native Developer Workflow"Velocity NY 2018 "The Cloud Native Developer Workflow"
Velocity NY 2018 "The Cloud Native Developer Workflow"Daniel Bryant
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?Viswanath J
 
MyAppConverter DroidconUK 2014
MyAppConverter DroidconUK 2014MyAppConverter DroidconUK 2014
MyAppConverter DroidconUK 2014myappconverter
 

Similar to The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023) (20)

Docker in Production: How RightScale Delivers Cloud Applications
Docker in Production: How RightScale Delivers Cloud ApplicationsDocker in Production: How RightScale Delivers Cloud Applications
Docker in Production: How RightScale Delivers Cloud Applications
 
Good bye Massive View Controller!
Good bye Massive View Controller!Good bye Massive View Controller!
Good bye Massive View Controller!
 
Keynote Client Connectivity And The Cloud
Keynote Client Connectivity And The CloudKeynote Client Connectivity And The Cloud
Keynote Client Connectivity And The Cloud
 
Cloud Native Application Integration With APIs
Cloud Native Application Integration With APIsCloud Native Application Integration With APIs
Cloud Native Application Integration With APIs
 
Embarcadero's Connected Development
Embarcadero's Connected DevelopmentEmbarcadero's Connected Development
Embarcadero's Connected Development
 
DevOps & SRE at Google Scale
DevOps & SRE at Google ScaleDevOps & SRE at Google Scale
DevOps & SRE at Google Scale
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015
 
Google Cloud - Scale With A Smile (Dec 2014)
Google Cloud - Scale With A Smile (Dec 2014)Google Cloud - Scale With A Smile (Dec 2014)
Google Cloud - Scale With A Smile (Dec 2014)
 
What's new in App Engine and intro to App Engine for Business
What's new in App Engine and intro to App Engine for BusinessWhat's new in App Engine and intro to App Engine for Business
What's new in App Engine and intro to App Engine for Business
 
1 - Welcome OPEN19 & Partners line-up
1 - Welcome OPEN19 & Partners line-up1 - Welcome OPEN19 & Partners line-up
1 - Welcome OPEN19 & Partners line-up
 
Flutter talkshow
Flutter talkshowFlutter talkshow
Flutter talkshow
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
 
Why Flutter.pdf
Why Flutter.pdfWhy Flutter.pdf
Why Flutter.pdf
 
Optimize your CI/CD with GitLab and AWS
Optimize your CI/CD with GitLab and AWSOptimize your CI/CD with GitLab and AWS
Optimize your CI/CD with GitLab and AWS
 
Bahrain ch9 introduction to docker 5th birthday
Bahrain ch9 introduction to docker 5th birthday Bahrain ch9 introduction to docker 5th birthday
Bahrain ch9 introduction to docker 5th birthday
 
Tampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday DockerTampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday Docker
 
Velocity NY 2018 "The Cloud Native Developer Workflow"
Velocity NY 2018 "The Cloud Native Developer Workflow"Velocity NY 2018 "The Cloud Native Developer Workflow"
Velocity NY 2018 "The Cloud Native Developer Workflow"
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?
 
MyAppConverter DroidconUK 2014
MyAppConverter DroidconUK 2014MyAppConverter DroidconUK 2014
MyAppConverter DroidconUK 2014
 
Web Leaps Forward
Web Leaps ForwardWeb Leaps Forward
Web Leaps Forward
 

More from François

C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)François
 
Monorepo & Monomythe (@Volcamp 2023)
Monorepo & Monomythe (@Volcamp 2023)Monorepo & Monomythe (@Volcamp 2023)
Monorepo & Monomythe (@Volcamp 2023)François
 
Collecte unifiée Server-to-Server - Tealium SNCF Connect (@EBG 2023)
Collecte unifiée Server-to-Server - Tealium SNCF Connect (@EBG 2023)Collecte unifiée Server-to-Server - Tealium SNCF Connect (@EBG 2023)
Collecte unifiée Server-to-Server - Tealium SNCF Connect (@EBG 2023)François
 
REX Flutter SNCF Connect (@VivaTech 2022).pdf
REX Flutter SNCF Connect (@VivaTech 2022).pdfREX Flutter SNCF Connect (@VivaTech 2022).pdf
REX Flutter SNCF Connect (@VivaTech 2022).pdfFrançois
 
OpenSource & InnerSource pour accélérer les développements
OpenSource & InnerSource pour accélérer les développementsOpenSource & InnerSource pour accélérer les développements
OpenSource & InnerSource pour accélérer les développementsFrançois
 
Dans le Monorepo vous n'êtes jamais seul, le Park est ouvert... 🦖🦕🐢 (@BreizhC...
Dans le Monorepo vous n'êtes jamais seul, le Park est ouvert... 🦖🦕🐢 (@BreizhC...Dans le Monorepo vous n'êtes jamais seul, le Park est ouvert... 🦖🦕🐢 (@BreizhC...
Dans le Monorepo vous n'êtes jamais seul, le Park est ouvert... 🦖🦕🐢 (@BreizhC...François
 
Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)
Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)
Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)François
 
Tock & Mélusine REX IA Open Source #AIParis 2020
Tock & Mélusine REX IA Open Source #AIParis 2020Tock & Mélusine REX IA Open Source #AIParis 2020
Tock & Mélusine REX IA Open Source #AIParis 2020François
 
Conversational AI & Open Source #OSSPARIS19
Conversational AI & Open Source #OSSPARIS19Conversational AI & Open Source #OSSPARIS19
Conversational AI & Open Source #OSSPARIS19François
 
TOCK (The Open Conversation Kit) @ Meetup Open Transport
TOCK (The Open Conversation Kit) @ Meetup Open TransportTOCK (The Open Conversation Kit) @ Meetup Open Transport
TOCK (The Open Conversation Kit) @ Meetup Open TransportFrançois
 
Monitoring une recette DevOps
Monitoring une recette DevOpsMonitoring une recette DevOps
Monitoring une recette DevOpsFrançois
 
DevOps et tendances Monitoring
DevOps et tendances MonitoringDevOps et tendances Monitoring
DevOps et tendances MonitoringFrançois
 

More from François (12)

C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
 
Monorepo & Monomythe (@Volcamp 2023)
Monorepo & Monomythe (@Volcamp 2023)Monorepo & Monomythe (@Volcamp 2023)
Monorepo & Monomythe (@Volcamp 2023)
 
Collecte unifiée Server-to-Server - Tealium SNCF Connect (@EBG 2023)
Collecte unifiée Server-to-Server - Tealium SNCF Connect (@EBG 2023)Collecte unifiée Server-to-Server - Tealium SNCF Connect (@EBG 2023)
Collecte unifiée Server-to-Server - Tealium SNCF Connect (@EBG 2023)
 
REX Flutter SNCF Connect (@VivaTech 2022).pdf
REX Flutter SNCF Connect (@VivaTech 2022).pdfREX Flutter SNCF Connect (@VivaTech 2022).pdf
REX Flutter SNCF Connect (@VivaTech 2022).pdf
 
OpenSource & InnerSource pour accélérer les développements
OpenSource & InnerSource pour accélérer les développementsOpenSource & InnerSource pour accélérer les développements
OpenSource & InnerSource pour accélérer les développements
 
Dans le Monorepo vous n'êtes jamais seul, le Park est ouvert... 🦖🦕🐢 (@BreizhC...
Dans le Monorepo vous n'êtes jamais seul, le Park est ouvert... 🦖🦕🐢 (@BreizhC...Dans le Monorepo vous n'êtes jamais seul, le Park est ouvert... 🦖🦕🐢 (@BreizhC...
Dans le Monorepo vous n'êtes jamais seul, le Park est ouvert... 🦖🦕🐢 (@BreizhC...
 
Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)
Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)
Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)
 
Tock & Mélusine REX IA Open Source #AIParis 2020
Tock & Mélusine REX IA Open Source #AIParis 2020Tock & Mélusine REX IA Open Source #AIParis 2020
Tock & Mélusine REX IA Open Source #AIParis 2020
 
Conversational AI & Open Source #OSSPARIS19
Conversational AI & Open Source #OSSPARIS19Conversational AI & Open Source #OSSPARIS19
Conversational AI & Open Source #OSSPARIS19
 
TOCK (The Open Conversation Kit) @ Meetup Open Transport
TOCK (The Open Conversation Kit) @ Meetup Open TransportTOCK (The Open Conversation Kit) @ Meetup Open Transport
TOCK (The Open Conversation Kit) @ Meetup Open Transport
 
Monitoring une recette DevOps
Monitoring une recette DevOpsMonitoring une recette DevOps
Monitoring une recette DevOps
 
DevOps et tendances Monitoring
DevOps et tendances MonitoringDevOps et tendances Monitoring
DevOps et tendances Monitoring
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)

  • 1. FROM 10 YEARS NATIVE TO The story of SNCF Connect with Flutter 1 24/02/2023 #FlutterHeroes23 THE BIGGEST FLUTTER APP IN EUROPE
  • 2. US (INCL. SPECIAL POWERS ;) 2 Adrien BODY 👨💼 Staff Engineer 🦸 A11Y Hero Valentin MICHALAK 👨💼 Software Engineer 🦸 E-sport Hero François NOLLEN 👨💼 Staff Engineer 🦸 Tech Ambassador
  • 3. OUR JOURNEY WITH FLUTTER 3 • The Project • Why Flutter ? • From native to Flutter • BFF • Core • Testing • Design & Accessibility • Routing & Monitoring • Performance • Conclusion
  • 4. SNCF CONNECT « Sustainable mobility accessible for all » 4
  • 5. OUR APPS BEFORE SNCF CONNECT 5
  • 6. A NEW DIGITAL SERVICE FOR TRAVEL AND MOBILITY 6 tickets sold in 2022 48 B kms traveled by customers in one year: that’s 3 millions tons of CO2 saved 1 B visits in 2022: that’s 3 millions a day >190 M SIMPLER MORE ACCESSIBLE GREENER CUSTOMIZABLE
  • 7. FROM ZERO TO HERO IN 18 MONTHS 7 Flutter React + SSR Kotlin/JVM 100% Cloud-native Infra-as-Code State of the Art Mobile Apps (150 screens) Web App Back-For-Front Infra From scratch Iterate faster Quality Continuous Delivery Monorepo One codebase One CI/CD pipeline Innersource One team From 10 to 200 developers* …in 18 months (*40 dedicated to Flutter) 18 months
  • 9. MODERN DECLARATIVE UI CANDIDATES IN 2020 9 Kotlin Multi Platform? Share business code with server (in Kotlin) Swift UI (version 1) Android Jetpack Compose (alpha) React Native? Share codebase between App & Web Performance and boot time issues (in 2020) Not convinced by tooling (more industrialization, better developer experience?)
  • 10. “Flutter is an open source framework by Google for building beautiful, natively compiled, multi-platform applications from a single codebase. “
  • 11. « IT’S ALL ABOUT SUSTENTATION » 11 Platforms ( , …) Your App (Alexandre, Entreprise Architect)
  • 12. FLUTTER MET OUR CRITERIA ● Very Good Performances ● Multi-platform ● Binary Size: OK ● Trusted Partners ● Google Contacts ● Early adopters (Google Pay, Ad Mob, Ali Express, EBay…) ● Mature ● Single Codebase ● Tooling, Developer Experience Our criteria (in real life)… TLDR;) (simpler version)
  • 13. LEVERAGING FLUTTER WEB TOO? (IN 2020) 13 PWA build 46.3 Mo Deferred loading No pure HTML (a11y?) 'pollute’ codebase Not stable Stable now Chart different between platforms CMS content injection SEO… complicated • Not suitable for our use case (e-commerce Website for millions of people) • Yet, a very promising technology! ? Condi2onal Imports
  • 14. FROM NATIVE TO FLUTTER 14
  • 15. MAIN BENEFITS FROM NATIVE 15 üHot Reload üIndependant from OS versions
  • 16. MINDSET CHANGED FROM NATIVE 16 • New paradigm ⚠ • UI-specific iOS / Android • Open Source 🎉
  • 17. BRIDGING TO NATIVE 17 • Bridges with Pigeon • Homemade bridges: Wallet IOS, Google Wallet • 3rd-party libs: Google Ads • Method Channel, FFI, … • 3rd-party Flutter SDKs provided by partners (Datadome, Batch, Instana, Didomi)
  • 19. BACK-FOR-FRONT APPLICATION SERVER • BFF = Backend For Frontend • Presentation logic moved serverside: • Presentation model / mapping • Formatting, Localization • Etc. ü Mobile/Web consistency 🔐 ü Better TTM 🚀 ü Smaller frontend apps 🌱 19 BFF server (Back-For-Front) Other channels (eg. chatbots) Mobile (iOS, Android) Web
  • 20. BFF à OPEN API à PROJECT SDK • Business models generated with Open API • Dart SDK (for Flutter/Mobile) • Typescript SDK (for React/Web) • Classes generated with built_value (generated immutable serialization/deserialization) • HTTP clients generated with Dio • Moustache templates • Models used for tests with fixtures 20
  • 23. THREADS IN FLUTTER 24 • Flutter is mono-threaded • MicroTask Queue, Event Queue • Futures • scheduleMicrotask • Isolates and Computes helper • Background tasks
  • 24. HOW WE USE THREADS 25 • Main thread for simple UI and logic • Isolates/Computes for complexe tasks • Eg. deserializing with compute dio_flu'er_transformer • Eg. multiple requests in // with isolate • scheduleMicrotask • Eg. network call needed for screen, prior to any other async Future • workmanager for background native tasks • Eg. background proactive exchange, based on geolocation (⚠ Remember that Compute has a little boot overhead time)
  • 26. OUR « TEST PYRAMID » golden_toolkit Golden Basic Widgets Tests UT over BLoC Automated E2E Widget Tests UI Tests Integration Tests Unit Tests
  • 28. BDD WITH CUCUMBER & GHERKIN 32
  • 29. GHERKIN FEATURES 33 Behaviour (shared with business teams) Tests Cases (exhaustive!) commercial_cards.feature
  • 30. END-TO-END TESTS WITH GHERKIN 34
  • 31. E2E TESTS 35 AN IN-HOUSE WRAPPER OVER APPIUM • Gherkin makes tests reusable between Mobile & Web (differents Glues)… • In addition, our wrapper over Appium improves: • Test reusability between Android & iOS (eg. generic types for widgets) • Shared logic about how we navigate, scroll, etc. during tests • Accessibility tests & guidelines easier to implement
  • 32. WIDGET TESTS WITH GHERKIN 36 • Flutter Gherkin • Widget Object Pattern inspired by E2E Tests and Page Object • Test your widgets with complex and exhaustive business cases • Quick to execute • Glues • Open source contribution: 👉 https://github.com/sncf-connect-tech/gherkin_widget_extension https://www.youtube.com/watch?v=QJHdwp0-zN0&t=716s (meetup Flutter Paris 17/01/2023)
  • 34. OUR TEST STRATEGY, RELOADED 38 https://medium.com/@a.poichet/flutter-and- the-practical-test-pyramid-with-the-bloc- pattern-6e6bf10dda9d https://medium.com/@maxime.pontoire/ automated-tests-of-a-flutter-application -3d878e9d8a61 • Golden • End 2 End • Widget Tests ● ⚠ Take time to run + heavy for your Git repo ● ⚠ Not idempotent (OS/architecture) è Docker ● 💚 Still very usefull in MR reviews ● 💚 Reused for Mobile and Web ● ⚠ integration_test limits (Webviews/native modals/perms) 💚 But Appium stable and working well! ● ⚠ But long to execute (cannot test all cases) ● 💚 Great to document code with use cases ● 💚 Fast, help us test all business use cases
  • 36. DESIGN SYSTEM • Figma • Generated code • Storybook (2023: Widgetbook?) • Flutter Web 40
  • 37. ACCESSIBILITY MATTERS 41 « The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. » Tim Berners-Lee, W3C Director and inventor of the World Wide Web
  • 38. ACCESSIBILITY MATTERS 42 « The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. » Tim Berners-Lee, W3C Director and inventor of the World Wide Web
  • 39. ACCESSIBILITY WITH FLUTTER • Very good and customizable 👍 • Dedicated widgets : Semantics, ExcludeSemantics • Semantic Service Still a few bugs opened on Flutter repo: • Focus Bugs • Read order bugs • Scroll shadows malfunctions: cacheExtent • Bridges bugs on some OS with keyboard for example 43 https://abody.medium.com/accessibility-in- flutter-tips-for-a-more-inclusive-app- 3e8406e9356d
  • 41. ACCESSIBILITY GOLDENS 45 45 Golden & manual tests in accessibility mode (enableSemanticDebugger)
  • 45. ROUTING & DEEPLINKS 49 go_router routemaster shelf_router yeet ● We first chose autoroute because it seemed mature ● Watching the go_router roadmap closely ;)
  • 46. MONITORING 50 Covering both frontend and backend Crash details and stacktraces ⚠ Obfuscation issue
  • 47. TRACKING & CONSENTS • Server-to-server tracking & consents management (GDPR) • Frontend instrumentation (route observer, CMP SDK, delegating to the BFF) ü Mobile/Web consistency 🔐 ü Better TTM 🚀 ü Less frontend 3rd-party SDKs 🛡 ü Reduced footprint 🌱 51 S2S tracking vendors BFF server (Back-For-Front) Other channels (eg. chatbots) Mobile (iOS, Android) Web
  • 49. HOW DOES IT GROW? (DEV XP & CI/CD) 53 ✅ Acceptable compilation time No need to modularize (too much) ✅ IDE always reactive ⚠ Test duration From 1 to 24 seconds per golden test on CI/CD ! 2700 tests Flutter ● Cut out in 10 jobs ● ~30m by job ● less than 10m local Build 32 minutes Build 22 minutes Careful when conflicts/rebase - Generated code - Goldens
  • 50. OPTIMIZED BUNDLES • Android App Bundles • Optimized bundles for different devices • In our case (average): 📉 -48% weight 54
  • 51. FOOTPRINT 55 85 Running times: 117.5 s Mobile data: 1.1 Mo 90 Energy: 112.8 mAh 50 • Many ways to contribute to a lower impact on clients and devices, eg. • Optimizing bundles • Server calls and payloads • Images / font-icons • Serverside logic • Limiting SDKs • … • Greenspector level Silver (July 2022) 🌱
  • 52. FRAMERATES Flutter performance IS impressive but still… framerate issues remain with 56 SHADER COMPILATION ⏳
  • 53. IMPELLER (PREVIEW) Before (Skia only) 57 After (Impeller)
  • 54. IMPELLER (PREVIEW) Very promising. Ready for production? Pros: - Very good results on our tests - Significant performance improvement (less / no more frame issue) Cons: - Not yet stable on Android (stable on iOS) - Issues with some dependencies (eg. Google Ads) 58 FUTURE LOADING…
  • 56. SUCCESSFUL PROJECT & PRODUCT ● Biggest Flutter app in Europe (so far!) ● Built/Delivered in 18 months ● Used by millions of people ● Weekly releases 60
  • 57. WE ❤ FLUTTER FOR… ● 🧑🤝🧑 Consensus among devs (native, backend…) ● 📚 Ultra-rich component library ● 🦺 App resilience ● 🔍 Very good documentation ● 🫶 Great and active community (Flutter Heroes! 👋🦸) Also : Declarative UI, Hot reload ⚡, Frequent Updates, Modern language and tools, Open Source, Performances, Simple Communication with Native… 61
  • 58. FLUTTER EVEN BETTER WHEN… 🧭 Stable navigation / routing (v1 imperative, v2 declarative, go_router?) ⚡ Remaining perf issues (Google Ads, frame jank à Impeller) 🕵 Code obfuscation // stacktrace (Firebase Crashlytics) And also : Dartlang, Flutter OS sensitive, remaining Accessibility issues… 62
  • 59. 63 HAPPILY STICKING WITH FLUTTER FOR WHAT’S NEXT!
  • 60. RESOURCES WE’VE SHARED (🇫🇷 / 🇬🇧) 64 Flutter @ Devoxx France E2E Testing with Flutter Widget Testing with Flutter Accessibility Testing with Flutter Flutter Impeller
  • 61. (☝ resources + jobs + contacts )