sh0umik
sh0umik

Reputation: 1669

Exclude certain file/lib for building in flutter web

Since Flutter web does not support dart:io lib yet and there are lots of packages depends on dart:io.

During the build for my app i am getting this error

transitive libraries have sdk dependencies that not supported on this platform:

app_core|lib/src/blocs/service/user_chat_bloc.dart
mqtt_client|lib/mqtt_client.dart

Lets say if i want to build without mqtt_client.dart or user_chat_bloc.dart. Building without this lib wont hurt for web but i want to keep the lib for flutter native. Also there is no clear documentation on how to skip building for those files.

The doc here https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings is also not clear on how to skip certain files

I have tried this in build.yaml but no luck

targets:
  $default:
    builders:
      build_web_compilers|app_core:
        generate_for:
          exclude:
            - lib/src/blocs/service/user_chat_bloc.dart
            - lib/mqtt_client.dart

Upvotes: 7

Views: 7222

Answers (1)

Tomek Polański
Tomek Polański

Reputation: 1753

You can do it in build.yaml like this:

targets:
  $default:
    sources:
      exclude:
        - lib/test_driver/runner.dart
        - lib/tools/**.dart

More details explanation you can find at the same article you've linked

Upvotes: 12

Related Questions