cross-platform development: maintain common codebase with platform dependent code

154 views
Skip to first unread message

Tom Verbeek

unread,
Mar 18, 2020, 12:38:01 PM3/18/20
to Desktop Embedding for Flutter
We are building cross-platform applications with Flutter. Is there a preferred way to keep a common code base for platform dependent code.
For instance we use dart:html for web specific code, but when compiling the code on macOS it fails with a lot of messages like

Launching lib/main.dart on macOS in debug mode...


Compiler message:
lib
/pages/spaceDetails.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html' as h;


I understand that dart:html is not available on macOS but how do I maintain a common codebase?
Are there ways to make import statements platform dependent?

Thx,
Tom.

Chris Sells

unread,
Mar 18, 2020, 12:40:33 PM3/18/20
to Tom Verbeek, Desktop Embedding for Flutter

--
You received this message because you are subscribed to the Google Groups "Desktop Embedding for Flutter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-desktop-embe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-desktop-embedding-dev/1c9d6108-e3e3-4edd-b5b8-0a9dfa9791c8%40googlegroups.com.

Tom Verbeek

unread,
Mar 18, 2020, 12:44:04 PM3/18/20
to Desktop Embedding for Flutter
wow, nice. Thx!


On Wednesday, March 18, 2020 at 5:40:33 PM UTC+1, Chris Sells wrote:
On Wed, Mar 18, 2020 at 9:38 AM Tom Verbeek <techn...@gmail.com> wrote:
We are building cross-platform applications with Flutter. Is there a preferred way to keep a common code base for platform dependent code.
For instance we use dart:html for web specific code, but when compiling the code on macOS it fails with a lot of messages like

Launching lib/main.dart on macOS in debug mode...


Compiler message:
lib
/pages/spaceDetails.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html' as h;


I understand that dart:html is not available on macOS but how do I maintain a common codebase?
Are there ways to make import statements platform dependent?

Thx,
Tom.

--
You received this message because you are subscribed to the Google Groups "Desktop Embedding for Flutter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-desktop-embedding-dev+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages