All Projects → fluttercandies → Jsontodart

fluttercandies / Jsontodart

Licence: mit
功能最全面的Json转换Dart的工具,支持Windows,Mac,Web以及Linux

Programming Languages

dart
5743 projects

Labels

Projects that are alternatives of or similar to Jsontodart

Simpleauth
The Simplest way to Authenticate and make Rest API calls in .Net
Stars: ✭ 148 (-24.1%)
Mutual labels:  uwp
Codehub
A UWP GitHub Client
Stars: ✭ 162 (-16.92%)
Mutual labels:  uwp
Rx Explorer
一款轻量的UWP文件管理器 | A lightweight UWP Explorer
Stars: ✭ 184 (-5.64%)
Mutual labels:  uwp
Gridextra
Custom panel controls for WPF/UWP.
Stars: ✭ 149 (-23.59%)
Mutual labels:  uwp
Uno.quickstart
An Uno "Hello world!" project using Windows UWP, iOS, Android and WebAssembly
Stars: ✭ 157 (-19.49%)
Mutual labels:  uwp
Microsoft.maui.graphics
Stars: ✭ 160 (-17.95%)
Mutual labels:  uwp
Directxtk
The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++
Stars: ✭ 1,918 (+883.59%)
Mutual labels:  uwp
Corehook
A library that simplifies intercepting application function calls using managed code and the .NET Core runtime
Stars: ✭ 191 (-2.05%)
Mutual labels:  uwp
Tiny.restclient
Simpliest Fluent REST client for .NET
Stars: ✭ 158 (-18.97%)
Mutual labels:  uwp
Mqttnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 2,486 (+1174.87%)
Mutual labels:  uwp
Megaapiclient
MegaApiClient is a C# .Net library to access http://mega.co.nz / http://mega.nz cloud storage and file hosting service.
Stars: ✭ 151 (-22.56%)
Mutual labels:  uwp
Crosswindow
💻📱 A cross platform system abstraction library written in C++ for managing windows and performing OS tasks.
Stars: ✭ 155 (-20.51%)
Mutual labels:  uwp
Windowstemplatestudio
Windows Template Studio quickly builds a UWP app, using a wizard-based UI to turn your needs into a foundation of Windows 10 patterns and best practices.
Stars: ✭ 2,089 (+971.28%)
Mutual labels:  uwp
Eshoponuwp
Universal Windows Platform line of business application showcasing the latest Windows 10 capabilities such as Fluent Design System, Ink and Windows Hello.
Stars: ✭ 149 (-23.59%)
Mutual labels:  uwp
Uno.playground
Source code for the Uno Gallery apps and Uno Playground (made in Wasm)
Stars: ✭ 184 (-5.64%)
Mutual labels:  uwp
Restclient.net
.NET REST Client Framework for all platforms
Stars: ✭ 143 (-26.67%)
Mutual labels:  uwp
Lc Finder
An image annotation and object detection tool written in C
Stars: ✭ 163 (-16.41%)
Mutual labels:  uwp
Directx12gameengine
DirectX 12 .NET game engine
Stars: ✭ 194 (-0.51%)
Mutual labels:  uwp
Ambie
A simple, elegant white noise app for Xbox and Windows
Stars: ✭ 187 (-4.1%)
Mutual labels:  uwp
Cloneapp
📦Easily Backup & Restore Windows Programs Settings
Stars: ✭ 163 (-16.41%)
Mutual labels:  uwp

功能最全面的Json转换Dart的工具,支持Windows,Mac,Web以及Linux。

相关:

Flutter Candies qq群181398081

下载

Github下载速度太慢,为了方便大家下载,特意在gitee也创建了下载地址。

UWP 微软商店

WPF for Windows

UWP for Windows10

Flutter for Macos

Flutter for Web

平台 语言 描述 代码/安装包地址
windows C# uwp构建,运行环境windows10,x86/x64 微软商店 以及 windows-uwp.zip
windows C# wpf构建,运行环境windows10/windows8/widnows7,x86/x64 windows-wpf.zip
windows dart flutter构建, 使用官方方式编译,x64 ,debug版本 windows-x64-flutter.zip
windows dart flutter构建, 使用go-flutter编译,x64 ,debug版本 windows-x64-go-flutter.zip
mac dart flutter构建,使用go-flutter编译(官方方式,未找到产物) mac-go-flutter.zip
web C# silverlight构建, 需要安装silverlight插件,有浏览器限制 网页地址带字体文件网页地址
web dart flutter-web构建 网页地址
linux dart flutter构建, 使用官方方式编译,(没有环境测试,假装可以用) 代码地址

安装

UWP(Windows10)

微软商店

商店大姨妈的时候,可以直接下载安装包

Windows10 用户

下载好安装包,解压。

第一次安装,需要安装证书,请按照下图,使用PowerShell打开Add-AppDevPackage.ps1,一路接受就安装完毕

后面如果工具有更新,可以下载最新的,然后点击FlutterCandiesJsonToDart_x.0.x.0_x86_x64.appxbundle 安装

WPF(Windows7/Windows8)

Windows7/Windows8 用户

下载解压,点击setup.exe安装

Silverlight(Web)

带字体文件是因为可能有乱码,由于中文字体问题,包含了中文字体文件,第一次会比较久,请耐心等待

首先需要安装Silverlight

Mac的用户下载Mac的,Windows用户下载Windows的

然后就是浏览器问题了,因为支持Silverlight的浏览器是有限的,除了Internet Explorer支持,以下版本的浏览器也支持.

Mac Safari 12.0以下的可以尝试这样开启插件

Mac Firefox这个版本能使用

Flutter(Mac)

go-flutter生成的产物是二进制程序,运行为exec,可以双击打开, 后由低调大佬测试打包DMG,安装即可,注意在安全性与隐私中同意安装,具体如何打包可以查看Go Flutter Desktop (二) go 二进制程序打包为 mac app(dmg)

Flutter(Windows_x64)

flutter官方产物或者go-flutter产物为exe,点击exe启动

使用

左边是json的输入框以及最后Dart生成的代码,右边是生成的Json类的结构

格式化

点击格式化按钮,将json转换为右边可视化的json类结构

更多设置

设置会全部自动保存(flutter版本除外,需要手动保存),一次设置终身受益

数据类型全方位保护

大家一定会有被服务端坑的时候吧? 不按规定好了的数据类型传值,导致json整个解析失败。

打开这个开关,就会在获取数据的时候加一层保护,代码如下

dynamic convertValueByType(value, Type type, {String stack: ""}) {
  if (value == null) {
    debugPrint("$stack : value is null");
    if (type == String) {
      return "";
    } else if (type == int) {
      return 0;
    } else if (type == double) {
      return 0.0;
    } else if (type == bool) {
      return false;
    }
    return null;
  }

  if (value.runtimeType == type) {
    return value;
  }
  var valueS = value.toString();
  debugPrint("$stack : ${value.runtimeType} is not $type type");
  if (type == String) {
    return valueS;
  } else if (type == int) {
    return int.tryParse(valueS);
  } else if (type == double) {
    return double.tryParse(valueS);
  } else if (type == bool) {
    valueS = valueS.toLowerCase();
    var intValue = int.tryParse(valueS);
    if (intValue != null) {
      return intValue == 1;
    }
    return valueS == "true";
  }
}

数组全方位保护

在循环数组的时候,一个出错,导致json整个解析失败的情况,大家遇到过吧?

打开这个开关,将对每一次循环解析进行保护,代码如下

void tryCatch(Function f) {
  try {
    f?.call();
  } catch (e, stack) {
    debugPrint("$e");
    debugPrint("$stack");
  }
}

遍历数组次数

在服务器返回的数据中,有时候数组里面不是每一个item都带有全部的属性,

如果只检查第一个话,会存在属性丢失的情况

你可以通过多次循环来避免丢失属性

选项有1,20,99

99就代表循环全部进行检查

属性命名

属性命名规范选项:保持原样,驼峰式命名小驼峰,帕斯卡命名大驼峰,匈牙利命名下划线

Dart 命名规范

Dart 官方推荐 驼峰式命名小驼峰

属性排序

对属性进行排序

排序选项: 保持原样,升序排列,降序排序

添加保护方法

是否添加保护方法。数据类型全方位保护/数组全方位保护 这2个开启的时候会生成方法。第一次使用的时候开启就可以了,你可以方法提出去,后面生成Dart就没有必要每个文件里面都要这2个方法了。

文件头部信息

可以在这里添加copyright,improt dart,创建人信息等等,支持[Date yyyy MM-dd]来生成时间,Date后面为日期格式。

比如[Date yyyy MM-dd] 会将你生成Dart代码的时间按照yyyy MM-dd的格式生成对应时间

属性访问器类型

点击格式化之后,右边会显示可视化的json类结构,在右边一列,就是属性访问器类型设置

选项:默认,Final,Get,GetSet

顶部设置修改,下面子项都会修改。你也可以单独对某个属性进行设置。

修改json类信息

点击格式化之后,右边会显示可视化的json类结构。

第一列为在json中对应的key

第二列为属性类型/类的名字。如果是类名,会用黄色背景提示

第三列是属性的名字

输入选项如果为空,会报红提示

生成Dart

做好设置之后,点击生成Dart按钮,左边就会生成你想要的Dart代码,并且提示“Dart生成成功,已复制到剪切板”,可以直接复制到你的Dart文件里面

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].