flutter
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;
}
Was this helpful?
Similar Posts