Issue 1:
Just doing what the error asked me to do...

Performing hot reload... |flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building _CupertinoBackGestureDetector<dynamic>(state:
flutter: _CupertinoBackGestureDetectorState<dynamic>#49fa6):
flutter: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4659 pos 12: 'child == _child':
flutter: is not true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter: https://github.com/flutter/flutter/issues/new
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 SingleChildRenderObjectElement.forgetChild (package:flutter/src/widgets/framework.dart:4659:12)
flutter: #3 Element._retakeInactiveElement (package:flutter/src/widgets/framework.dart:2880:14)
flutter: #4 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:32)
flutter: #5 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #6 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4666:14)
flutter: #7 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #8 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4771:32)
flutter: #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #10 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #11 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #12 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #13 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #14 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3781:11)
flutter: #15 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #16 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #17 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #18 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4666:14)
flutter: #19 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #20 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #21 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #22 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #23 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #24 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3781:11)
flutter: #25 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #27 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #28 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4666:14)
flutter: #29 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #30 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #31 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #32 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #33 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #34 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3781:11)
flutter: #35 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #37 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #38 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4666:14)
flutter: #39 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #40 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #41 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #42 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #43 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #44 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3781:11)
flutter: #45 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #46 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #47 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #48 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #49 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #50 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #51 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #52 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #53 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #54 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #55 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #56 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #57 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3781:11)
flutter: #58 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #59 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #60 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #61 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4666:14)
flutter: #62 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #63 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #64 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #65 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #66 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #67 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #68 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #69 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #70 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4666:14)
flutter: #71 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #72 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #73 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #74 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #75 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #76 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3781:11)
flutter: #77 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #78 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #79 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #80 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #81 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #82 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #83 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #84 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #85 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #86 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4666:14)
flutter: #87 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #88 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #89 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #90 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #91 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3634:5)
flutter: #92 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3629:5)
flutter: #93 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2919:14)
flutter: #94 Element.updateChild (package:flutter/src/widgets/framework.dart:2722:12)
flutter: #95 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3665:16)
flutter: #96 Element.rebuild (package:flutter/src/widgets/framework.dart:3507:5)
flutter: #97 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2255:33)
flutter: #98 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:653:20)
flutter: #99 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
flutter: #100 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
flutter: #101 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
flutter: #102 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:751:7)
flutter: #104 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
flutter: #105 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
flutter: #106 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
flutter: (elided 3 frames from class _AssertionError and package dart:async)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1503 pos 18: 'debugDoingThisResize || debugDoingThisLayout ||
flutter: Another exception was thrown: RenderBox was not laid out: RenderDecoratedBox#f6bc9 NEEDS-PAINT DETACHED
flutter: Another exception was thrown: RenderBox was not laid out: RenderFractionalTranslation#9a6a5 NEEDS-PAINT DETACHED
flutter: Another exception was thrown: RenderBox was not laid out: RenderFractionalTranslation#dd093 NEEDS-PAINT DETACHED
flutter: Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#7f910 NEEDS-PAINT DETACHED
flutter: Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#c76ae NEEDS-PAINT DETACHED
flutter: Another exception was thrown: RenderBox was not laid out: RenderOffstage#0dc73 NEEDS-PAINT
flutter: Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#7f910 NEEDS-PAINT DETACHED
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 3236 pos 12: '_ancestorChain.length == 1': is not true.
flutter: Another exception was thrown: Duplicate GlobalKey detected in widget tree.

Here's my main.dart, in case that's helpful:

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
┊ return MaterialApp(
┊ ┊ title: 'Gamebook',
┊ ┊ home: Scaffold(
┊ ┊ ┊ appBar: AppBar(
┊ ┊ ┊ ┊ title: Text('Gamebook'),
┊ ┊ ┊ ),
┊ ┊ ┊ body: Center(
┊ ┊ ┊ ┊ child: Gamebook(),
┊ ┊ ┊ ),
┊ ┊ ),
┊ );
}
}

class GamebookState extends State<Gamebook> {
@override
Widget build(BuildContext context) {
┊ AssetBundle bundle = DefaultAssetBundle.of(context);
┊ return Text(loadAsset(bundle));
┊ //return Text("This is a book where your choices matter!");
}

String loadAsset(AssetBundle bundle) async {
┊ return await bundle.loadString('books/Your_Father_The_Hero.md');
}
}

class Gamebook extends StatefulWidget {
@override
GamebookState createState() => new GamebookState();
}

Issue 2:
This is a common pattern:

double get size {
assert(mounted);
RenderBox box = context.findRenderObject();
assert(box != null);
assert(box.hasSize);
return box.size;
}

We should add this to the BuildContext method as a function that returns a Size. It should assert we're not calling it during a frame (certainly not in the build phase, anyway). In checked mode, it should return a _WidgetDebugSize, a new class that refuses to be used during the build phase.