Skip to content

Instantly share code, notes, and snippets.

@sawin0
Last active February 23, 2024 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sawin0/8262f087524ce9b1a22d192422bddd37 to your computer and use it in GitHub Desktop.
Save sawin0/8262f087524ce9b1a22d192422bddd37 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
debugInvertOversizedImages = true;
runApp(const MaterialApp(home: RftReaderScreen()));
}
class RftReaderScreen extends StatefulWidget {
const RftReaderScreen({Key? key}) : super(key: key);
@override
State<RftReaderScreen> createState() => _RftReaderScreenState();
}
class _RftReaderScreenState extends State<RftReaderScreen> {
String? _res;
@override
void initState() {
super.initState();
// Here we are accessing example.rtf file
// loadString method fetches all the text from example.rtf file
// after loading all the text we are setting to our local variable
rootBundle.loadString("assets/example.rtf").then((value) => setState(() {
_res = value;
}));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text(_res ?? "Loading . . ."),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment