1. 12 Mar, 2024 1 commit
    • Jackson Gardner's avatar
      Flutter Web Bootstrapping Improvements (#144434) · 3c30e3cb
      Jackson Gardner authored
      This makes several changes to flutter web app bootstrapping.
      * The build now produces a `flutter_bootstrap.js` file.
        * By default, this file does the basic streamlined startup of a flutter app with the service worker settings and no user configuration.
        * The user can also put a `flutter_bootstrap.js` file in the `web` subdirectory in the project directory which can have whatever custom bootstrapping logic they'd like to write instead. This file is also templated, and can use any of the tokens  that can be used with the `index.html` (with the exception of `{{flutter_bootstrap_js}}`, see below).
      * Introduced a few new templating tokens for `index.html`:
        * `{{flutter_js}}` => inlines the entirety of `flutter.js`
        * `{{flutter_service_worker_version}}` => replaced directly by the service worker version. This can be used instead of the script that sets the `serviceWorkerVersion` local variable that we used to have by default.
        * `{{flutter_bootstrap_js}}` => inlines the entirety of `flutter_bootstrap.js` (this token obviously doesn't apply to `flutter_bootstrap.js` itself).
      * Changed `IndexHtml` to be called `WebTemplate` instead, since it is used for more than just the index.html now.
      * We now emit warnings at build time for certain deprecated flows:
        * Warn on the old service worker version pattern (i.e.`(const|var) serviceWorkerVersion = null`) and recommends using `{{flutter_service_worker_version}}` token instead
        * Warn on use of `FlutterLoader.loadEntrypoint` and recommend using `FlutterLoader.load` instead
        * Warn on manual loading of `flutter_service_worker.js`.
      * The default `index.html` on `flutter create` now uses an async script tag with `flutter_bootstrap.js`.
      3c30e3cb
  2. 09 Feb, 2024 1 commit
  3. 15 Dec, 2023 1 commit
    • Srujan Gaddam's avatar
      Move package:web dependency to dev dependency (#139696) · 2407f699
      Srujan Gaddam authored
      Pinning the package:web dependency constrains downstream packages from
      using newer versions and making sure they support the version pinned in
      Flutter. Since the usage of package:web in Flutter is light, we should
      instead have a small shim like the engine and keep package:web as a dev
      dependency only.
      2407f699
  4. 15 Nov, 2023 1 commit
    • Srujan Gaddam's avatar
      Pin package:web 0.4.0 (#138428) · d8ffc739
      Srujan Gaddam authored
      This version is needed so that dart:js_interop can move to extension
      types. Also adds some code to handle some breaking changes:
      
      - Body -> Response. Body was an IDL interface mixin type we exposed in
      dart:html. Going forward, users should either use Request or Response.
      - Casts to JSAny. These are temporary until we move package:web types to
      extension types. Currently, package:web types can't implement JSObject
      as JSObject will move to be an extension type itself.
      Co-authored-by: 's avatarKevin Moore <kevmoo@users.noreply.github.com>
      d8ffc739
  5. 27 Oct, 2023 1 commit
    • David Iglesias's avatar
      [web] Add 'nonce' prop to flutter.js loadEntrypoint (#137204) · 15ccf24d
      David Iglesias authored
      ## Description
      
      This PR adds a `nonce` parameter to flutter.js' `loadEntrypoint` method.
      
      When set, loadEntrypoint will add a `nonce` attribute to the `main.dart.js` script tag, which allows Flutter to run in environments slightly more restricted by CSP; those that don't add `'self'` as a valid source for `script-src`.
      
      ----
      
      ### CSP directive
      
      After this change, the CSP directive for a Flutter Web index.html can be:
      
      ```
      script-src 'nonce-YOUR_NONCE_VALUE' 'wasm-unsafe-eval';
      font-src https://fonts.gstatic.com;
      style-src 'nonce-YOUR_NONCE_VALUE';
      ```
      
      When CSP is set via a `meta` tag (like in the test accompanying this change), and to use a service worker, the CSP needs an additional directive: [`worker-src 'self';`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/worker-src)
      
      When CSP set via response headers, the CSP that applies to `flutter_service_worker.js` is determined by its response headers. See **Web Workers API > [Content security policy](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#content_security_policy)** in MDN.)
      
      ----
      
      ### Initialization
      
      If the CSP is set to disallow `script-src 'self'`, a nonce needs to also be passed to `loadEntrypoint`:
      
      ```javascript
        _flutter.loader.loadEntrypoint({
          nonce: 'SOME_NONCE',
          onEntrypointLoaded: (engineInitializer) async {
            const appRunner = await engineInitializer.initializeEngine({
              nonce: 'SOME_NONCE',
            });
            appRunner.runApp();
          },
        });
      ```
      
      (`nonce` shows twice for now, because the entrypoint loader script doesn't have direct access to the `initializeEngine` call.)
      
      ----
      
      ## Tests
      
      * Added a smoke test to ensure an app configured as described above starts.
      
      ## Issues
      
      * Fixes https://github.com/flutter/flutter/issues/126977
      15ccf24d
  6. 11 Oct, 2023 1 commit
  7. 29 Sep, 2023 1 commit
  8. 20 Sep, 2023 2 commits
  9. 14 Sep, 2023 1 commit
  10. 12 Sep, 2023 1 commit
  11. 27 Jul, 2023 1 commit
  12. 15 Jun, 2023 1 commit
  13. 16 May, 2023 1 commit
  14. 08 May, 2023 1 commit
  15. 10 Apr, 2023 1 commit
  16. 24 Mar, 2023 1 commit
  17. 23 Mar, 2023 1 commit
  18. 21 Mar, 2023 1 commit
  19. 23 Feb, 2023 1 commit
  20. 02 Feb, 2023 2 commits
  21. 27 Jan, 2023 1 commit
  22. 10 Jan, 2023 1 commit
  23. 20 Dec, 2022 5 commits
  24. 09 Dec, 2022 1 commit
    • Siva's avatar
      Manual Roll of Flutter Engine from 67254d6e4b03 to 8d83b98c55b3 (#116635) · 7c8e1713
      Siva authored
      * Roll Flutter Engine from 67254d6e4b03 to 8d83b98c55b3
      
      * Roll Dart SDK from 35a9facce191 to e517487c5679 (Dart 3.0) (#38105)
      
      * Bump SDK versions.
      
      * Bump Dart SDK version constraints
      
      * Update shrine package to 2.0.1 (null safe version)
      
      * Fix more tests.
      
      * Include patches from Jason for min android sdk version
      
      * Fix analyzer warning
      7c8e1713
  25. 21 Oct, 2022 2 commits
  26. 20 Oct, 2022 1 commit
  27. 29 Sep, 2022 1 commit
  28. 23 Sep, 2022 1 commit
  29. 22 Sep, 2022 1 commit
  30. 19 Sep, 2022 1 commit
  31. 25 Aug, 2022 2 commits
  32. 05 Aug, 2022 1 commit