Skip to content

default value #236

Closed
Closed

Description

@lastmeta

in the yaml file can I specify a default value for the field?

class: Address
table: address

fields:  
  address: String
  used: bool
    #default: true  #something like this?

Activity

  1. added
    enhancement
    on Jul 15, 2022
  2. fischerscode commented on Sep 27, 2022

    @fischerscode
    Contributor

    @vlidholt do you envision any special way how this should be implemented? Sounds like a nice PR...

  3. ramyak-mehra commented on Feb 12, 2023

    @ramyak-mehra

    we can handle the default value on the sql side or dart side

  4. vlidholt commented on Feb 13, 2023

    @vlidholt
    Collaborator

    It would be a cool addition, but I think the implementation needs to be thought through. Handling the default value on the Dart side is probably best, but it may only be possible to do primitive types (other serializable objects would be tricky). Also, what should the syntax look like. Needs to feel clean and be backwards compatible.

  5. fischerscode commented on Feb 13, 2023

    @fischerscode
    Contributor

    I think it would be best to provide the serialized version of the data in the yaml file. This could be used to set the default in the database, and a dart default could be constructed, too, by using the SerializationManager.

    I'm currently working on a package that helps specify and parse yaml based configuration files. I think it'd be the perfect fit for specifying the class definitions. (Had this as a usecase in mind)

  6. SandPod commented on Aug 14, 2024

    @SandPod
    Contributor

    Closing this as duplicate for the more specified issue here #1140.

    PS. This is being implemend right now 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions