monaco_editor 0.0.1+2 copy "monaco_editor: ^0.0.1+2" to clipboard
monaco_editor: ^0.0.1+2 copied to clipboard

Platformweb

A Flutter plugin for using the monaco editor in the WEB application

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:monaco_editor/monaco_editor.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  final controller1 = MonacoEditorController();
  final controller2 = MonacoEditorController();

  @override
  void initState() {
    controller1.initialize(
      MonacoEditorOptions(
        language: MonacoLanguage.json,
        theme: MonacoTheme.vsDark,
      ),
    );
    controller2.initialize(
      MonacoEditorOptions(
        language: MonacoLanguage.json,
        theme: MonacoTheme.vsDark,
      ),
    );
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        floatingActionButton: FloatingActionButton(
          onPressed: () async {
            controller1.setText('hello');
          },
          child: const Icon(Icons.add),
        ),
        appBar: AppBar(
          title: const Text('Monaco Editor Example'),
        ),
        body: Row(
          children: [
            Expanded(
              child: MonacoEditorWidget(
                controller: controller1,
              ),
            ),
            Expanded(
              child: MonacoEditorWidget(
                controller: controller2,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
130
points
2
downloads

Publisher

verified publisherbritto.dev

Weekly Downloads

A Flutter plugin for using the monaco editor in the WEB application

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_web_plugins, monaco_editor_platform_interface, monaco_editor_web, web

More

Packages that depend on monaco_editor