Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use utf8.encode() instead of longer const Utf8Encoder.convert() #43675

Merged
merged 2 commits into from
Jul 14, 2023

Commits on Jul 14, 2023

  1. Use utf8.encode() instead of longer const Utf8Encoder.convert()

    The change in [0] has propagated now everywhere, so we can use
    `utf8.encode()` instead of the longer `const Utf8Encoder.convert()`.
    
    Also it cleans up code like
    
    ```
      Uint8List bytes;
      bytes.buffer.asByteData();
    ```
    
    as that is not guaranteed to be correct, the correct version would be
    
    ```
      Uint8List bytes;
      bytes.buffer.asByteData(bytes.offsetInBytes, bytes.length);
    ```
    
    a shorter hand for that is:
    
    ```
      Uint8List bytes;
      ByteData.sublistView(bytes);
    ```
    
    [0] dart-lang/sdk#52801
    mkustermann committed Jul 14, 2023
    Configuration menu
    Copy the full SHA
    e5be47f View commit details
    Browse the repository at this point in the history
  2. address comment

    mkustermann committed Jul 14, 2023
    Configuration menu
    Copy the full SHA
    5f06b8d View commit details
    Browse the repository at this point in the history