dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.28k stars 1.58k forks source link

[json_codable] support static fromJson #59579

Open cedvdb opened 1 day ago

cedvdb commented 1 day ago

json_codable currently check if there is a constructor with fromJson, no check is made for a static method.

use case

In order to support override of a serialization method used for enums. This is a preliminary issue before adding enum support

dart-github-bot commented 1 day ago

Summary: Users request json_codable support for static fromJson methods. This allows overriding serialization for enums.