Where to look at source code of Flutter/Dart "UInt8List"

145

Answer by @jonahwilliams:

There is additional dart code in *_patch.dart files as part of the Dart SDK. For example:

https://github.com/dart-lang/sdk/blob/master/sdk/lib/_internal/vm/lib/typed_data_patch.dart

This code contains native declarations like:

factory Uint8List(int length) native "TypedData_Uint8Array_new"; Which corresponds to a C++ code like: https://github.com/dart-lang/sdk/blob/6fe15f6df93150b377c306d15b1173454fda48c2/runtime/lib/typed_data.cc

And my reply (digging into more details):

p.s. What I have found by your clues (as a remark for myself):

  1. The constructor(new Uint8list) https://github.com/dart-lang/sdk/blob/6fe15f6df93150b377c306d15b1173454fda48c2/runtime/lib/typed_data.cc#L204
  2. The actual TypedData https://github.com/dart-lang/sdk/blob/6fe15f6df93150b377c306d15b1173454fda48c2/runtime/vm/object.h#L9768
Share:
145
ch271828n
Author by

ch271828n

Hello, world :)

Updated on November 24, 2022

Comments

  • ch271828n
    ch271828n over 1 year

    I am learning and exploring the source code of Flutter. I see UInt8List (and its friends) in sky_engine/lib/typed_data/typed_data.dart. However, there is only declarations (like an interface) without any implementations. I am very curious about its actual implementation, so I wonder where can I see them?

    My guesses: They may be C++ code; they may have implemented the external function external factory Uint8List(int length);. However, after looking around the flutter Github repo I still cannot find anything related.

    Thanks!

    • ch271828n
      ch271828n over 3 years
      @ChristopherMoore I am using Flutter (not flutter for web) thus there is no JS. Thanks!