About C# to Dart
C# to Dart is a basic utility that converts your C# POCO classes to Dart classes.
If you're developing mobile applications using Dart/Flutter and using C# to develop your API project, this utility makes it a bit easier to create the data transfer classes you need.
For more information about Dart and JSON serialization,the Flutter documentation has an excellent article about it.
If you have any comments or suggestions please give a shout out on Twitter. You can also log an issue on GitHub
Here is an example of two C# classes that will convert to Dart without problems:
25
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace MyApp.Models
{
public class Product
{
public int ProductId { get; set; }
[Column(TypeName = "varchar(250)")]
public string Title { get; set; }
[Column(TypeName = "varchar(250)")]
public string SubTitle { get; set; }
public bool IsActive { get; set; }
public virtual List<ProductOption> Options { get; set; }
}
public class ProductOption
{
[Column(TypeName = "varchar(100)")]
public string Title { get; set; }
public double Price { get; set; }
public int QuantityInStock { get; set; }
Update History
Oct 16, 2023
Add the C# to Dart CLI
Added a CLI to automate code conversion.
Oct 12, 2023
Add support for C# Enums
Added some enum support for xlean
Aug 27, 2022
Improved support for C# Lists
Improved support for Lists and nullable types. Github Issue #2
Aug 14, 2022
Support for Nullable C# types
Added support for nullable types in C#. Github Issue #1
Dec 31, 2021
Multiple classes support
Added support for multiple classes as well as support for List<>
Dec 22, 2021
Added extra generation options
Added options to set all properties as nullable and add required constructor parameters.
Dec 18, 2021
Initial Release
Basic functionality for class generation