Git Product home page Git Product logo

yt's People

Contributors

faithoflifedev avatar johann13 avatar m4w avatar udiedrichsen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

yt's Issues

I wrote the code following the sample code, but an error occurred.

here is my source code

import "dart:io";

import "package:flutter/material.dart";
import "package:image_picker/image_picker.dart";
import "package:yt/yt.dart";

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

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

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Flutter Demo",
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: "Flutter Demo Home Page"),
);
}
}

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});

final String title;

@override
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: OutlinedButton(
onPressed: () async {
XFile? file = await ImagePicker().pickVideo(source: ImageSource.gallery);
final yt = Yt.withKey("--- My API key ---");
final body = <String, dynamic>{
"snippet": {
"title": "TEST title",
"description": "Test Description",
"tags": [
"tag1",
"tag2"
],
"categoryId": "22"
},
"status": {
"privacyStatus": "private",
"embeddable": true,
"license": "youtube"
}
};
final vfile = File(file!.path);
final videoItem = await yt.videos.insert(body: body, videoFile: vfile);
print(videoItem);
},
child: const Text("Upload..."),
),
),
);
}
}

The above code was written as an exercise.

However, the following error occurs:

E/flutter ( 8711): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
E/flutter ( 8711): #0 Yt.videos (package:yt/src/yt_base.dart:43:31)
E/flutter ( 8711): #1 _MyHomePageState.build.<anonymous closure> (package:yt_exam/main.dart:72:40)
E/flutter ( 8711): <asynchronous suspension>
E/flutter ( 8711):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.