uri_content 0.0.1 copy "uri_content: ^0.0.1" to clipboard
uri_content: ^0.0.1 copied to clipboard

Get the content of a Uri

example/lib/main.dart

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:uri_content/uri_content.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final uriContentFuture = Uri.parse(
          "https://raw.githubusercontent.com/talesbarreto/pull_request_coverage/main/README.md")
      .getContent()
      .then(utf8.decode);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text("Test of Uris"),
        ),
        body: ListView(
          children: [
            FutureBuilder<String>(
              future: uriContentFuture,
              builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
                return Text(snapshot.data ?? "Loading?");
              },
            ),
          ],
        ),
      ),
    );
  }
}
10
likes
0
pub points
95%
popularity

Publisher

unverified uploader

Get the content of a Uri

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, pigeon

More

Packages that depend on uri_content