Search code snippets, questions, articles...

GetX with flutter

import 'package:get/get.dart';
import 'package:path to datastoring file/dataFileName.dart';//path to data file

class className {
	final dataFileClassName = Get.find<dataFileClassName>();

	//Set Data
	dataFileClassName.boolVarName.value = true;
	dataFileClassName.stringVarName.value = "Some Text";
	dataFileClassName.floatVarName.value = 2.0;
	dataFileClassName.intergerVarName.value = 10;
	dataFileClassName.arrayVarName.value = ["1", "2", "3"];

	//Read Data
	dataFileClassName.boolVarName.value;
	dataFileClassName.stringVarName.value;
	dataFileClassName.floatVarName.value;
	dataFileClassName.intergerVarName.value;
	dataFileClassName.arrayVarName.value;
}


// User data file
import 'package:get/get.dart';

class dataFileClassName extends GetxController {
  RxBool boolVarName = false.obs;
  RxString stringVarName = "Loading".obs;
  RxDouble floatVarName = 0.0.obs;
  RxInt intergerVarName = 0.obs;
  RxList arrayVarName = [].obs;
}
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.

Search Index Data (The code snippet can also be found with below search text)

GetX
Was this helpful?
0 Comments