Created
March 3, 2020 11:37
-
-
Save Bruising6802/ad02fa013bcb8130cf1a74d5c57fc327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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