title: Make retrived data form firestore global string
body: <p>i would like to retrieve this particular data(Container(child: Text(snapshot.data!['audio'].toString())),) from data firestore and make it a global variable so i can access it from another file</p>
  <pre><code>    import 'dart:html';
  
      import 'package:cloud_firestore/cloud_firestore.dart';
     import 'package:flutter/material.dart';
     import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
     import 'package:flutter_screenutil/flutter_screenutil.dart';
     import 'package:goodwork/allscreens/pagemanage.dart';
  
  class Songpage extends StatefulWidget {
   final docId;
   Songpage(this.docId);
  
  @override
   _SongpageState createState() =&gt; _SongpageState(docId);
   }
  
  class _SongpageState extends State&lt;Songpage&gt; {
    final docId;
    _SongpageState(this.docId);
  
      late final PageManager _pageManager;
  
     @override
    void initState() {
      super.initState();
      _pageManager = PageManager();
      }
  
   @override
   void dispose() {
     _pageManager.dispose();
     super.dispose();
   }
  
   @override
   Widget build(BuildContext context) {
     return Scaffold(
      appBar: AppBar(
           backgroundColor: Colors.white,
          title: const Text(
          &quot;Audio Player&quot;,
          style: TextStyle(color: Colors.black),
        ),
        leading: const Image(
          image: AssetImage(&quot;images/logo.png&quot;),
        )),
    body: ListView(
      children: &lt;Widget&gt;[
        StreamBuilder&lt;DocumentSnapshot&gt;(
          stream: FirebaseFirestore.instance
              .collection('Audio')
              .doc(docId)
              .snapshots(),
          builder: (BuildContext context,
              AsyncSnapshot&lt;DocumentSnapshot&gt; snapshot) {
            if (snapshot.hasError) return Text('Error: ${snapshot.error}');
            if (!snapshot.hasData)
              return Container(
                child: Center(child: CircularProgressIndicator()),
              );
            String url = '${snapshot.data!['audio']}';
  
            return Column(
              children: &lt;Widget&gt;[
                Container(
                  child: Text(
                    snapshot.data!['title'],
                    style: TextStyle(fontSize: 24.0),
                  ),
                ),
                Container(
                  child: Image(
                    image: NetworkImage(snapshot.data!['image']),
                  ),
                ),
                Container(child: Text(snapshot.data!['duration'])),
                Container(child: Text(snapshot.data!['audio'].toString())),
                SizedBox(
                  height: 30.h,
                ),
                ValueListenableBuilder&lt;ProgressBarState&gt;(
                  valueListenable: _pageManager.progressNotifier,
                  builder: (_, value, __) {
                    return ProgressBar(
                      progress: value.current,
                      buffered: value.buffered,
                      total: value.total,
                      onSeek: _pageManager.seek,
                    );
                  },
                ),
                ValueListenableBuilder&lt;ButtonState&gt;(
                  valueListenable: _pageManager.buttonNotifier,
                  builder: (_, value, __) {
                    switch (value) {
                      case ButtonState.loading:
                        return Container(
                          margin: const EdgeInsets.all(8.0),
                          width: 32.0,
                          height: 32.0,
                          child: const CircularProgressIndicator(),
                        );
                      case ButtonState.paused:
                        return IconButton(
                          icon: const Icon(Icons.play_arrow),
                          iconSize: 32.0,
                          onPressed: _pageManager.play,
                        );
                      case ButtonState.playing:
                        return IconButton(
                          icon: const Icon(Icons.pause),
                          iconSize: 32.0,
                          onPressed: _pageManager.pause,
                        );
                    }
                  },
                ),
              ],
            );
          },
        )
      ],
    ),
    );
    }
   }
  </code></pre>
  <p>Please i need help on this i have been struggle with if for om ours i tried it here with this line  String url = '${snapshot.data!['audio']}'; but it cant access it from this file below is the code of the file i want to access it from.</p>
  <pre><code>   class PageManager {
  
     final progressNotifier = ValueNotifier&lt;ProgressBarState&gt;(
     ProgressBarState(
     current: Duration.zero,
     buffered: Duration.zero,
     total: Duration.zero,
     ),
    );
   final buttonNotifier = ValueNotifier&lt;ButtonState&gt;(ButtonState.paused);
  
   late AudioPlayer _audioPlayer;
   PageManager() {
     _init();
   }
  
   void _init() async {
    _audioPlayer = AudioPlayer();
     await _audioPlayer.setUrl();
  
     _audioPlayer.playerStateStream.listen((playerState) {
       final isPlaying = playerState.playing;
       final processingState = playerState.processingState;
      if (processingState == ProcessingState.loading ||
        processingState == ProcessingState.buffering) {
      buttonNotifier.value = ButtonState.loading;
    } else if (!isPlaying) {
      buttonNotifier.value = ButtonState.paused;
    } else if (processingState != ProcessingState.completed) {
      buttonNotifier.value = ButtonState.playing;
    } else {
      _audioPlayer.seek(Duration.zero);
      _audioPlayer.pause();
    }
  });
  
  _audioPlayer.positionStream.listen((position) {
    final oldState = progressNotifier.value;
    progressNotifier.value = ProgressBarState(
      current: position,
      buffered: oldState.buffered,
      total: oldState.total,
    );
  });
  
  _audioPlayer.bufferedPositionStream.listen((bufferedPosition) {
    final oldState = progressNotifier.value;
    progressNotifier.value = ProgressBarState(
      current: oldState.current,
      buffered: bufferedPosition,
      total: oldState.total,
    );
  });
  
  _audioPlayer.durationStream.listen((totalDuration) {
    final oldState = progressNotifier.value;
    progressNotifier.value = ProgressBarState(
      current: oldState.current,
      buffered: oldState.buffered,
      total: totalDuration ?? Duration.zero,
    );
    });
   }
  
   void play() {
   _audioPlayer.play();
  }
  
   void pause() {
    _audioPlayer.pause();
    }
  
   void seek(Duration position) {
   _audioPlayer.seek(position);
   }
  
  void dispose() {
  _audioPlayer.dispose();
   }
  }
  
    class ProgressBarState {
     ProgressBarState({
     required this.current,
    required this.buffered,
    required this.total,
     });
    final Duration current;
   final Duration buffered;
   final Duration total;
    }
  
    enum ButtonState { paused, playing, loading }
  </code></pre>