Can we us Flutter's Google mobile ads package for showing ads except admob in Flutter - TagMerge
2Can we us Flutter's Google mobile ads package for showing ads except admob in FlutterCan we us Flutter's Google mobile ads package for showing ads except admob in Flutter

Can we us Flutter's Google mobile ads package for showing ads except admob in Flutter

Asked 1 years ago
0
2 answers

You need mediation for that. You integrate Ad Units to display ads, if you integrate ad units from Facebook only Facebook Ads will display and so.

Source: link

1

First, we need to install Flutter SDK with the following command:
$ sudo snap install flutter --classic
After that, we need to enable desktop development mode:
$ flutter config --enable-<platform>-desktop
// <platform> = linux, windows, macos
Like any other typical CLI, we can create a new application with the create command as shown below:
$ flutter create desktop-app
The lib/main.dart file contains the main source code of your application. Let’s modify the main source code as shown below to create a simple “Hello World” application:
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'TextPad',
      theme: ThemeData(
        primarySwatch: Colors.green,
      ),
      home: Scaffold(
        body: Center(
          child: Text('Hello World')
        ),
      ),
    );
  }
}
After editing the main source file, enter the following command to run your application:
$ flutter run -d <platform>
// <platform> = linux, windows, macos
Similar to the previous Hello-World application, add the following source code into the main application source file:
import 'dart:io';
import 'package:flutter/material.dart';


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

    final textController = new TextEditingController();
    final globalKey = GlobalKey<ScaffoldState>();
    final String fileName = 'textPadNote.txt';

     Future<void> _exportToFile(BuildContext context) async {
       final File file = File('${Directory.current.absolute.path}/${fileName}');
       final snackBar = SnackBar(content: Text('Saved to: ${file.path}'));

       await file.writeAsString(textController.text);
       globalKey.currentState.showSnackBar(snackBar);
    }
  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      title: 'TextPad',
      theme: ThemeData(
                brightness: Brightness.dark,
           ),
      home: Scaffold(
        key: globalKey,
        appBar: AppBar(
          title: Text('TextPad'),
          actions: <Widget>[
              IconButton(
                    icon: const Icon(Icons.save),
                    tooltip: 'Export to ${fileName}',
                    onPressed: () {_exportToFile(context);}
                  )]
        ),
        body: Center(
          child: TextField(
                controller: textController,
                maxLines: null,
                keyboardType: TextInputType.multiline,
                expands: true,
                  decoration: InputDecoration(
    hintText: 'Play with your notes here...',
    contentPadding: EdgeInsets.all(12.0)
  ),
          ),
        ),
      ),
    );
  }
}
When we are debugging the application, debuggable binaries will be created. However, debuggable binaries are not optimized for a release. Execute the following command on the terminal to make optimized binaries:
$ flutter build <platform>
// <platform> = linux, windows, macos

Source: link

Recent Questions on flutter

    Programming Languages