schema_org 2.0.0 copy "schema_org: ^2.0.0" to clipboard
schema_org: ^2.0.0 copied to clipboard

JSON-LD Flutter/Dart classes for the full Schema.org vocabulary, generated from the official schema distribution. Emit structured data from Flutter web apps with type-safe constructors, or serialize t [...]

example/lib/main.dart

// Copyright (c) Oddbit (https://oddbit.id)
//
// This source file is part of schema_org.
// Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.

import 'package:flutter/material.dart';
import 'package:schema_org/schema_org.dart';
import 'package:schema_org/schemas/organization.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    SchemaOrg.writeJsonLd(SchemaOrganization(
      name: 'Oddbit',
      url: 'https://oddbit.id',
      logo: 'https://avatars.githubusercontent.com/u/1946799?s=200&v=4',
    ));
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Schema.org Example App',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSwatch(
          primarySwatch: Colors.green,
          accentColor: Colors.green.shade700,
          brightness: Brightness.dark,
        ),
      ),
      home: Scaffold(
        body: Center(
          child: IntrinsicWidth(
            child: Card(
              child: Padding(
                padding: const EdgeInsets.all(16.0),
                child: Row(
                  children: [
                    const CircleAvatar(
                      backgroundImage: NetworkImage(
                          'https://avatars.githubusercontent.com/u/1946799?s=200&v=4'),
                      radius: 30,
                    ),
                    const SizedBox(width: 16),
                    Text(
                      'Oddbit',
                      style: Theme.of(context).textTheme.titleLarge?.copyWith(
                            color: Colors.green,
                          ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
9
likes
150
points
88
downloads

Documentation

API reference

Publisher

verified publisheroddbit.id

Weekly Downloads

JSON-LD Flutter/Dart classes for the full Schema.org vocabulary, generated from the official schema distribution. Emit structured data from Flutter web apps with type-safe constructors, or serialize to a JSON-LD string on any target with `SchemaOrg.toJsonLdString`.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter, web

More

Packages that depend on schema_org