Skip to content

Instantly share code, notes, and snippets.

@Bruising6802
Created March 3, 2020 11:37
Show Gist options
  • Save Bruising6802/ad02fa013bcb8130cf1a74d5c57fc327 to your computer and use it in GitHub Desktop.
Save Bruising6802/ad02fa013bcb8130cf1a74d5c57fc327 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'dart:convert';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
static Widget widi = Container(
color: Colors.black,
height: 200,
width: 100,
child: Text('D'),
);
static Map<String, dynamic> map = {'widget': widi.toString()};
static var jss = jsonEncode(map);
static var jde = jsonDecode(jss);
static String widgete = map['widget'];
WidgetJson widgetJson = WidgetJson(widget: widgete);
@override
Widget build(BuildContext context) {
print(jde);
return Scaffold(
appBar: AppBar(
title: Text("Widget Title"),
),
body: Stack(
children: <Widget>[],
),
);
}
}
class WidgetJson {
WidgetJson({this.widget});
String widget;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment