Upgrade to Pro — share decks privately, control downloads, hide ads and more …

LINE TECHPULSE 2020 - Efficient Event Tracking Mechanism with Flutter

LINE TECHPULSE 2020 - Efficient Event Tracking Mechanism with Flutter

Efficient Event Tracking Mechanism with Flutter by Kuan Wei Lin @ LINE TECHPULSE 2020 https://techpulse.line.me/

2102a6b8760bd6f57f672805723dd83a?s=128

line_developers_tw

December 18, 2020
Tweet

Transcript

  1. Kuan-Wei Lin / LINE TAIWAN iOS Engineering Team Efficient Event

    Tracking Mechanism with Flutter
  2. LINE SHOPPING App Taiwan

  3. Event Tracking Screen Event Click Event User Event Analysis

  4. Third Party Plugin LINE Tracking Service Plugin Tracking Event Tools

  5. Architecture Third Party Plugin LINE Tracking Service Plugin Wrapper Class

    Wrapper Class Internal External
  6. TrackingManager Third Party Plugin LINE Tracking Service Plugin Wrapper Class

    Wrapper Class Widget Architecture Internal External sendTrackingEvent()
  7. Challenge - Secure Code Quality

  8. Challenge - Secure Code Quality Widget Widget Widget Widget Widget

    Widget Widget Widget Widget
  9. Challenge - Secure Code Quality Integration Tests Widget Tests Unit

    Tests
  10. Challenge - Secure Code Quality Widget Tests

  11. import 'package:mockito/mockito.dart' class MockTrackingManager extends Mock implements TrackingManager {}

  12. void main() { final mockTrackingManager = MockTrackingManager(); testWidgets('Test MyWidget exists.',

    (tester) async { await tester.pumpWidget(MyWidget(mockTrackingManager)); await tester.tap(find.byType(MyWidget).first); expect(find.byType(MyWidget), findsOneWidget); verify(mockTrackingManager.sendTrackingEvent()).called(1); // More Other assertions… }); } import 'package:mockito/mockito.dart' class MockTrackingManager extends Mock implements TrackingManager {}
  13. void main() { final mockTrackingManager = MockTrackingManager(); testWidgets('Test MyWidget exists.',

    (tester) async { await tester.pumpWidget(MyWidget(mockTrackingManager)); await tester.tap(find.byType(MyWidget).first); expect(find.byType(MyWidget), findsOneWidget); verify(mockTrackingManager.sendTrackingEvent()).called(1); // More Other assertions… }); } import 'package:mockito/mockito.dart' class MockTrackingManager extends Mock implements TrackingManager {}
  14. void main() { final mockTrackingManager = MockTrackingManager(); testWidgets('Test MyWidget exists.',

    (tester) async { await tester.pumpWidget(MyWidget(mockTrackingManager)); await tester.tap(find.byType(MyWidget).first); expect(find.byType(MyWidget), findsOneWidget); verify(mockTrackingManager.sendTrackingEvent()).called(1); // More Other assertions… }); } import 'package:mockito/mockito.dart' class MockTrackingManager extends Mock implements TrackingManager {}
  15. void main() { final mockTrackingManager = MockTrackingManager(); testWidgets('Test MyWidget exists.',

    (tester) async { await tester.pumpWidget(MyWidget(mockTrackingManager)); await tester.tap(find.byType(MyWidget).first); expect(find.byType(MyWidget), findsOneWidget); verify(mockTrackingManager.sendTrackingEvent()).called(1); // More Other assertions… }); } import 'package:mockito/mockito.dart' class MockTrackingManager extends Mock implements TrackingManager {}
  16. void main() { final mockTrackingManager = MockTrackingManager(); testWidgets('Test MyWidget exists.',

    (tester) async { await tester.pumpWidget(MyWidget(mockTrackingManager)); await tester.tap(find.byType(MyWidget).first); expect(find.byType(MyWidget), findsOneWidget); verify(mockTrackingManager.sendTrackingEvent()).called(1); // More Other assertions… }); } import 'package:mockito/mockito.dart' class MockTrackingManager extends Mock implements TrackingManager {}
  17. Wrap Up › It may take extra time to build

    app using Flutter because some plugins may need to be built by your team due to it is not available. › Try to use Flutter’s widget tests to secure your code quality in every code change and release. › It’s alway challenging to use new tools or frameworks, but it’s a fun journey to learn.
  18. Thank you